-
Notifications
You must be signed in to change notification settings - Fork 107
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(vue): components presence #1943
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
omg it's working |
@TylerAPfledderer @iamdin I'd be happy for your review. I hope I didn't miss anything important. Maybe it's that last PR before Ark UI 1.0 for Vue ^^ |
@Omikorin any reason why changes in react and solid tests are showing up here? |
Yes, I found flaky or missing tests between those, so I synced them by the rule "do it now while you remember". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Omikorin on initial pass, this is great and I do not see anything missing related to presence.
I only have one tiny nitpick though 😄
|
||
const triggerProps = computed(() => ({ | ||
...api.value.triggerProps, | ||
'aria-controls': presenceApi.value.isUnmounted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this attribute should disappear after the initial rendering of the dialog content with lazyMount
. Once the dialog content is rendered to the DOM, this attribute should stay attached to the trigger, else the purpose of it is lost.
In other words, the attribute only matters when a user navigates to the trigger, and it should be present if the associated content is visible in the DOM.
I also acknowledge that this attribute does not have much support with screen readers at the moment; it will not be acknowledged by any of the major SRs, with only JAWS ensuring the user's ability to jump to the controlled element.
My above comments stand in regards to future-proof.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've checked the behavior. This attribute disappears only when using lazyMount
with unmountOnExit
(like in Dialog
LazyMount
story). Otherwise, it stays in place along with lazy-mounted content.
It's the same situation in React, so let's ask Chris.
@cschroeter, what do you think about a11y case that Tyler brought?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just glimpsed over the conversation. lazyMount
or unmountOnExit
has often a negative impact on a11y. It is a tradeoff for performance. My recommendation is to avoid using lazyMount
or unmountOnExit
if possible.
I've read a bit about this topic here: w3c/aria#995 and as far as I can tell there is no clear winner if aria-controls
should be removed, empty or just point to the hidden element.
Under this assumption please keep the current solution as it passes the Storybook a11y Addon and this axe addon for jest some contributor brought up.
Cheeers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks mate. I agree with the current solution.
@TylerAPfledderer I'll dismiss the request then and merge PR. I appreciate your review! :)
|
||
const triggerProps = computed(() => ({ | ||
...api.value.triggerProps, | ||
'aria-controls': presenceApi.value.isUnmounted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as with DialogTrigger
|
||
const triggerProps = computed(() => ({ | ||
...api.value.triggerProps, | ||
'aria-controls': presenceApi.value.isUnmounted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto comment with DialogTrigger
If checked then done/fixed etc
Not working lazy mounting (from tests):
Aria errors (tests):
Presence existing in component (rewritten):
Note: Working Presence is understood as
lazyMount
passed to a component'sRoot
part (like in Chakra UIisLazy
). There is no reason to prefer props in items (I know there is, although it's a simpler and more intuitive approach).