Skip to content

Commit 319c16d

Browse files
committed
fix: Avoid cropping focus ring in popover trigger when not wrapping its text
1 parent 1bfc081 commit 319c16d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/popover/styles.scss

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ $trigger-underline-offset: 0.25em;
2020
&.no-wrap {
2121
white-space: nowrap;
2222
}
23+
24+
// When the trigger text is set to be ellipsized, render the focus ring on the root element instead of the trigger,
25+
// to prevent it from being cropped by its `overflow: hidden` rule.
26+
// We do this in only this case because when the trigger has multiple lines of texts its height can differ from the root element.
27+
&:has(.trigger-type-text-inline.overflow-ellipsis:focus, .trigger-type-text.overflow-ellipsis:focus) {
28+
@include focus-visible.when-visible-unfocused {
29+
@include styles.focus-highlight(1px);
30+
}
31+
}
2332
}
2433

2534
.root-filtering-token {
@@ -77,8 +86,10 @@ $trigger-underline-offset: 0.25em;
7786
outline: none;
7887
}
7988

80-
@include focus-visible.when-visible {
81-
@include styles.focus-highlight(1px);
89+
&:not(.overflow-ellipsis) {
90+
@include focus-visible.when-visible {
91+
@include styles.focus-highlight(1px);
92+
}
8293
}
8394
}
8495

0 commit comments

Comments
 (0)