Focus Visible Issues with Button #7033
Unanswered
stevegreco
asked this question in
Q&A
Replies: 1 comment
-
All the docs examples should have Here are a few examples: .react-aria-Button {
color: var(--text-color);
background: var(--button-background);
border: 1px solid var(--border-color);
border-radius: 4px;
appearance: none;
vertical-align: middle;
font-size: 1rem;
text-align: center;
margin: 0;
outline: none; /* <---------- */
padding: 6px 10px;
text-decoration: none;
&[data-pressed] {
box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.1);
background: var(--button-background-pressed);
border-color: var(--border-color-pressed);
}
&[data-focus-visible] {
outline: 2px solid var(--focus-ring-color);
outline-offset: -1px;
}
} .react-aria-ListBoxItem {
margin: 2px;
padding: 0.286rem 0.571rem;
border-radius: 6px;
outline: none; /* <---------- */
cursor: default;
color: var(--text-color);
font-size: 1.072rem;
position: relative;
display: flex;
flex-direction: column;
&[data-focus-visible] {
outline: 2px solid var(--focus-ring-color);
outline-offset: -2px;
}
&[data-selected] {
background: var(--highlight-background);
color: var(--highlight-foreground);
&[data-focus-visible] {
outline-color: var(--highlight-foreground);
outline-offset: -4px;
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am aware from other discussions that the fact that the
Button
is focuses programmatically causes the:focus-visible
styles to be appliedonPress
. My issue is that the examples in the documentation seem to not have this behavior, so I am curious how that is being accomplished.We have a global fallback to ensure consistency, but even if I remove that, we just get the browser defaults for the
:focus-visible
on theButton
.I am curious what is being done in the documentation to prevent this on the
Button
, but when I use theButton
I am getting different behavior. How are people addressing this?This seems to work, but I do not see anything close to this in the CSS as part of the docs examples.
Beta Was this translation helpful? Give feedback.
All reactions