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

refactor(tag): enabled keyboard focusability again #1880

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 25 additions & 2 deletions packages/components/src/components/tag/tag.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
}

&:not([data-no-text="true"]) {
padding-inline: variables.$db-spacing-fixed-2xs;
--db-padding-inline-start: #{variables.$db-spacing-fixed-2xs};
padding-inline: var(--db-padding-inline-start) #{variables.$db-spacing-fixed-2xs};

&:has(.db-tab-remove-button) {
padding-inline-end: 0;
Expand Down Expand Up @@ -90,8 +91,29 @@
}
}

// Handle native radio and checkbox input elements, especially regarding focus-visible indicator
// TODO: Reevaluate whether we could use the standard HTML elements instead of our components
input {
display: none;
inline-size: calc(100% + 2px);
block-size: calc(100% + 2px);
position: absolute;
margin-inline-end: initial;
border: none;
border-radius: inherit;
transform: translateX(
calc(
(
var(
--db-padding-inline-start,
#{variables.$db-spacing-fixed-2xs}
) + #{variables.$db-border-height-sm}
) * -1
)
);

&:checked::before {
--db-icon: "";
}
}
}

Expand All @@ -103,6 +125,7 @@

&::after {
--db-icon-margin-start: 0;
--db-icon-font-size: 0;
content: "" !important;
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/styles/_icon-passing.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
a,
button,
label {
padding-inline-start: calc(
--db-padding-inline-start: calc(
#{$inline-start} + #{icons.$default-icon-margin-end} +
var(--db-base-font-size) * var(--db-base-line-height)
);
padding-inline-start: var(--db-padding-inline-start);
}
}
}
Loading