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(vue): components presence #1943

Merged
merged 32 commits into from
Jan 1, 2024
Merged

fix(vue): components presence #1943

merged 32 commits into from
Jan 1, 2024

Conversation

Omikorin
Copy link
Collaborator

@Omikorin Omikorin commented Dec 30, 2023

If checked then done/fixed etc

Not working lazy mounting (from tests):

  • Combobox
  • Hover Card
  • Popover
  • Tabs

Aria errors (tests):

  • Dialog.Trigger aria-controls
  • Menu.Trigger aria-controls
  • Popover.Trigger aria-controls

Presence existing in component (rewritten):

  • Accordion
  • Color Picker
  • Combobox
  • Date Picker
  • Dialog (flaky tests, presence didn't work from the start)
  • Hover Card
  • Menu
  • Popover
  • Select
  • Tabs
  • Tooltip

Note: Working Presence is understood as lazyMount passed to a component's Root part (like in Chakra UI isLazy). There is no reason to prefer props in items (I know there is, although it's a simpler and more intuitive approach).

Copy link

vercel bot commented Dec 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
ark-docs ✅ Ready (Inspect) Visit Preview Dec 31, 2023 2:46am

@Omikorin
Copy link
Collaborator Author

omg it's working

@Omikorin
Copy link
Collaborator Author

@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 Omikorin marked this pull request as ready for review December 31, 2023 02:57
@TylerAPfledderer
Copy link
Collaborator

TylerAPfledderer commented Jan 1, 2024

@Omikorin any reason why changes in react and solid tests are showing up here?

@Omikorin
Copy link
Collaborator Author

Omikorin commented Jan 1, 2024

@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".

Copy link
Collaborator

@TylerAPfledderer TylerAPfledderer left a 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
Copy link
Collaborator

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.

Copy link
Collaborator Author

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?

Copy link
Member

Choose a reason for hiding this comment

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

@TylerAPfledderer @Omikorin

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

Copy link
Collaborator Author

@Omikorin Omikorin Jan 1, 2024

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
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto comment with DialogTrigger

@Omikorin Omikorin merged commit cbc8764 into main Jan 1, 2024
7 checks passed
@Omikorin Omikorin deleted the fix/vue-components-presence branch January 1, 2024 19:27
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.

3 participants