Skip to content

Apply the disabled attribute to toolbar buttons - #806

Open
etuan wants to merge 1 commit into
embedpdf:v2from
etuan:fix/disabled-toolbar-buttons-focusable
Open

etuan wants to merge 1 commit into
embedpdf:v2from
etuan:fix/disabled-toolbar-buttons-focusable

Conversation

@etuan

@etuan etuan commented Sep 11, 2026

Copy link
Copy Markdown

Summary

Hello, we've been working through an accessibility audit which flagged a few issues with your amazing library.

The shared Button component (viewers/snippet/src/components/ui/button.tsx) computes disabled-looking styles (opacity-50, cursor-not-allowed, ...) from its disabled prop, but never applies the native disabled attribute to the rendered <button>. As a result, a visually disabled toolbar button — e.g. Previous Page at the start of a document, Next Page at the end — remains in the Tab order and can still be reached and activated by keyboard.

Fix

Pass disabled={disabled} through to the native element. One line.

Steps to reproduce (before this fix)

  1. Open a multi-page PDF in the viewer.
  2. Tab to the Previous Page button while on page 1 (so it's disabled/greyed out).
  3. Observe it still receives keyboard focus.

WCAG 2.4.3 (Focus Order) — focus should not land on a control that cannot be activated.

Testing

No test suite currently exists for @embedpdf/snippet, so this is manually verified per the repro steps above. Happy to add a test if there's a preferred harness/pattern for this package I should follow.

Button computed disabled-looking styles from the disabled prop but
never set the native disabled attribute, so a visually disabled
button (e.g. Previous/Next Page at a document boundary) still
received keyboard focus and could still be activated by other means.
@vercel

vercel Bot commented Sep 11, 2026

Copy link
Copy Markdown

@etuan is attempting to deploy a commit to the CloudPDF Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant