Skip to content

Expose current value of the lightbox duration spinbutton to screen readers - #156

Closed
stepan-kuntso wants to merge 1 commit into
DHTMLX:masterfrom
stepan-kuntso:fix/lightbox-duration-aria-valuenow
Closed

stepan-kuntso wants to merge 1 commit into
DHTMLX:masterfrom
stepan-kuntso:fix/lightbox-duration-aria-valuenow

Conversation

@stepan-kuntso

@stepan-kuntso stepan-kuntso commented Nov 16, 2026 •

Copy link
Copy Markdown

What is broken

In the lightbox, the duration input has role="spinbutton" and aria-valuemin="0",
but no aria-valuenow. Safari + VoiceOver on macOS therefore announces the field as
"0, Duration, stepper" even when it shows e.g. 18.

Version: 10.0.3. Browser/OS: Safari, macOS, VoiceOver.

How to reproduce

  1. npm run build, open samples/20_multiple/07_keyboard_navigation.html.
  2. Turn on VoiceOver (Cmd+F5).
  3. Focus a task, press Enter to open the lightbox.
  4. Tab to the duration field.

Expected: VoiceOver announces the value shown in the field.
Actual: VoiceOver announces "0".

Cause

lightboxDurationInputAttrString in src/core/ui/wai_aria.js renders the spinbutton
role and aria-valuemin, but the current value is never exposed. The value is set
after rendering (in DurationControl.prototype.set_value), so it cannot be added
to the static attribute string.

Fix

  • wai_aria.js: new lightboxDurationInputValueAttr(input, value, text) that sets
    aria-valuenow and aria-valuetext (removed when the field is empty). Like every
    _waiAria method, it is a no-op when wai_aria_attributes is disabled.
  • duration_control.js: call it at the end of _calc_date, which runs when the
    lightbox opens, after the -/+ buttons, arrow keys, typing and date changes.

aria-valuenow is the numeric duration that get_value will save; aria-valuetext
is the text shown in the field, so a custom formatter (e.g. "8 days") is read as
displayed.

How to verify

Tested in Safari on macOS with VoiceOver, sample
samples/20_multiple/07_keyboard_navigation.html:

  • Tabbing into the duration field: before — "0, Duration, stepper" while the field
    shows 8; after — "8, Duration, stepper".
  • After changing the value (arrow keys / typing), VoiceOver announces the edit as a
    text change ("selection replaced 7"); re-reading the field (VO+F3) reports the
    updated value ("17, Duration, stepper").
  • With gantt.config.wai_aria_attributes = false no attributes are added.
  • npm run build, npm run lint, npm run test (128 samples) pass.

Screenshots

Before:
Screenshot 2026-11-16 at 15 54 42

After:
Screenshot 2026-11-16 at 15 55 33

The duration input in the lightbox has role="spinbutton" but no
aria-valuenow, so VoiceOver announces it as "0". Set aria-valuenow
and aria-valuetext whenever the duration is recalculated.
@AlexKlimenkov

Copy link
Copy Markdown
Contributor

Thank you for the fix and for the clear write-up, @stepan-kuntso!

We reviewed the change and accepted it. As described in CONTRIBUTING.md, this repository is generated from our internal source, so we applied the change there. It will ship in the next bugfix release (10.0.4). We will close this PR with a link to that release.

Thanks again for the contribution!

@stepan-kuntso

Copy link
Copy Markdown
Author

Thank you, Alex! Glad it was useful. I'll watch for 10.0.4.

@AlexKlimenkov

Copy link
Copy Markdown
Contributor

Hi @stepan-kuntso
We've just published v10.0.4, your fix is in place
https://github.com/DHTMLX/gantt/blob/v10.0.4/whatsnew.md?plain=1#L20

Thanks again for contributing!

@stepan-kuntso

Copy link
Copy Markdown
Author

Thank you, and thanks for extending it to the baseline durations as well.
Glad it was useful.

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.

2 participants