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

Calendar Month & Year select Aria-hidden bug #902

Closed
Jels02 opened this issue Nov 7, 2024 · 3 comments
Closed

Calendar Month & Year select Aria-hidden bug #902

Jels02 opened this issue Nov 7, 2024 · 3 comments

Comments

@Jels02
Copy link

Jels02 commented Nov 7, 2024

Describe the bug

When opening a focusable component within the Calendar component header, an error will display in the browser console, about the ancestor (The calendar header) containing the "aria-hidden=true" prop but the child being focusable.

Reproduction

Can be reproduced on the shadcn-svelte docs site: https://shadcn-svelte.com/docs/components/calendar#month--year-selects
It's not super consistent, on both the docsl site and on my project that I encountered the bug in, but I can reproduce it consisently in my browser (tested on Arc, Chrome and Edge):

  • open console tab
  • reload page
  • switch to elements tab (before interacting with calendar)
  • open the month or year selecter

If you have issuse with reproducing let me know and I will attach a video.

Logs

No response

System Info

System:
    OS: macOS 14.6.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 34.83 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.4.1 - /opt/homebrew/bin/node
    npm: 10.8.1 - /opt/homebrew/bin/npm
    pnpm: 9.5.0 - /opt/homebrew/bin/pnpm
    bun: 1.1.21 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 130.0.6723.116
    Edge: 130.0.2849.68
    Safari: 17.6
  npmPackages:
    @sveltejs/kit: ^2.0.0 => 2.7.4
    bits-ui: 1.0.0-next.46 => 1.0.0-next.46
    formsnap: 2.0.0-next.1 => 2.0.0-next.1
    lucide-svelte: ^0.454.0 => 0.454.0
    mode-watcher: ^0.4.1 => 0.4.1
    svelte: ^5.0.0 => 5.1.9
    sveltekit-superforms: ^2.20.0 => 2.20.0

Severity

annoyance

@huntabyte
Copy link
Owner

It's not consistent because it's more of a timing thing that chrome is freaking out about. We remove the aria-hidden attribute basically at the same time as we focus on the element. I'll look into seeing how we can ensure they are never taking place at the same time.

This is an issue for Bits UI, so I'm going to move it there.

@huntabyte huntabyte transferred this issue from huntabyte/shadcn-svelte Nov 9, 2024
@huntabyte huntabyte added bug Something isn't working PRIORITY: medium labels Jan 29, 2025
@huntabyte huntabyte added this to the 1.0 milestone Jan 29, 2025
@huntabyte
Copy link
Owner

Fortunately, Chrome is intelligent enough to block the aria-hidden in this case.

Notes to myself for later:

This is due to Calendar.Heading being used to render a visual heading, and we handle the actually accessible heading via an aria-live announcer.

Adding buttons and such in the heading causes issues since the parent of focusable content is marked as aria-hidden, which is a nono.

I think we can more effectively mark specific parts of the heading as hidden, given they are not interactive, rather than the entire container.

@huntabyte
Copy link
Owner

This is actually an issue on my end with the element ordering in shadcn-svelte. We shouldn't be using the Calendar.Heading there, and instead the selects should go into the Calendar.Header, wrapped in a div for styling purposes if required.

@huntabyte huntabyte removed this from the 1.0 milestone Jan 30, 2025
@huntabyte huntabyte removed the bug Something isn't working label Jan 30, 2025
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

No branches or pull requests

2 participants