Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(form-file): file-selector-button cutoff in Safari #1614

Merged
merged 5 commits into from
Jul 10, 2023

Conversation

imagoiq
Copy link
Contributor

@imagoiq imagoiq commented Jul 6, 2023

What

UI

Webkit

File_input_Webkit

Firefox

File_input_Firefox

Chrome

File_input_Chrome

@changeset-bot
Copy link

changeset-bot bot commented Jul 6, 2023

🦋 Changeset detected

Latest commit: b55e65d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@swisspost/design-system-styles Patch
@swisspost/design-system-components-angular Patch
@swisspost/design-system-components Patch
@swisspost/design-system-demo Patch
@swisspost/design-system-documentation Patch
@swisspost/internet-header Patch
@swisspost/design-system-intranet-header Patch
@swisspost/design-system-components-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@swisspost-bot
Copy link
Contributor

swisspost-bot commented Jul 6, 2023

Preview environment ready: https://preview-1614--swisspost-web-frontend.netlify.app
Preview environment ready: https://preview-1614--swisspost-design-system-next.netlify.app

Comment on lines 79 to 105
[lang='de'] & {
content: 'Datei auswählen';
}

[lang='fr'] & {
content: 'Choisir un fichier';
}

[lang='it'] & {
content: 'Scegli file';
}
}

&[multiple] {
&::after {
content: 'Choose Files';

[lang='de'] & {
content: 'Dateien auswählen';
}

[lang='fr'] & {
content: 'Sélect. fichiers';
}
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL that File Input does not use the lang attribute, but the browser language. So, this might look weird if your browser uses another language than the page you are visiting.

2 notes:

  • Italian plural is similar to singular.
  • Translations are based on what Chrome provide natively.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has already been the source of confusion for some people. We'll provide a much improved file upload web-component that will fix this issue. For the native one, we're just providing on a best effort base. I suspect that use cases where these languages differ are quite rare and if they happen, the user most likely understands both languages.

bottom: 0;
right: 0;
z-index: 2;
padding-inline: forms.$input-padding-y;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed for valid and invalid state. Previously, we inherited padding value from Bootstrap. It works for all cases except those valid and invalid state where the padding right and left aren't the same. Issue was already there in #1297

@@ -51,25 +51,90 @@ select.form-control-rg:not([size]):not([multiple]) {
border-left: inherit;
}

// Fix Safari cutoff when change the initial position of the selector button.
@supports (background: -webkit-named-image(i)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@imagoiq imagoiq changed the title Fix 1492 text file input safari fix(form-file): file-selector-button cutoff in Safari Jul 6, 2023
Copy link
Member

@gfellerph gfellerph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix!

.changeset/brown-cows-notice.md Outdated Show resolved Hide resolved
packages/styles/src/components/forms.scss Outdated Show resolved Hide resolved
Comment on lines 79 to 105
[lang='de'] & {
content: 'Datei auswählen';
}

[lang='fr'] & {
content: 'Choisir un fichier';
}

[lang='it'] & {
content: 'Scegli file';
}
}

&[multiple] {
&::after {
content: 'Choose Files';

[lang='de'] & {
content: 'Dateien auswählen';
}

[lang='fr'] & {
content: 'Sélect. fichiers';
}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has already been the source of confusion for some people. We'll provide a much improved file upload web-component that will fix this issue. For the native one, we're just providing on a best effort base. I suspect that use cases where these languages differ are quite rare and if they happen, the user most likely understands both languages.

imagoiq and others added 2 commits July 10, 2023 09:09
Co-authored-by: Philipp Gfeller <1659006+gfellerph@users.noreply.github.com>
@sonarcloud
Copy link

sonarcloud bot commented Jul 10, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@imagoiq imagoiq merged commit aae6952 into main Jul 10, 2023
10 checks passed
@imagoiq imagoiq deleted the fix-1492-text-file-input-safari branch July 10, 2023 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants