Skip to content

Commit 71a9bbd

Browse files
Zeba Afia Shamaclaude
authored andcommitted
Fix quantity input +/- buttons decrementing under screen readers
QuantityInput.onButtonClick used event.target.name to determine which button was pressed. When activated via screen reader/keyboard, the event target resolves to the visually-hidden accessible-name span inside the button (which has no name attribute) rather than the button itself, so the plus button incorrectly fell through to stepDown(). Mouse clicks were unaffected since they hit-test to the button directly. Use event.currentTarget.name instead, matching the pattern already used in the slider's onButtonClick in the same file. Fixes #3972 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFhzTdXdDnPmBJzysuzKuD
1 parent 258f00f commit 71a9bbd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

assets/global.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ class QuantityInput extends HTMLElement {
246246
event.preventDefault();
247247
const previousValue = this.input.value;
248248

249-
if (event.target.name === 'plus') {
249+
if (event.currentTarget.name === 'plus') {
250250
if (parseInt(this.input.dataset.min) > parseInt(this.input.step) && this.input.value == 0) {
251251
this.input.value = this.input.dataset.min;
252252
} else {
@@ -258,7 +258,7 @@ class QuantityInput extends HTMLElement {
258258

259259
if (previousValue !== this.input.value) this.input.dispatchEvent(this.changeEvent);
260260

261-
if (this.input.dataset.min === previousValue && event.target.name === 'minus') {
261+
if (this.input.dataset.min === previousValue && event.currentTarget.name === 'minus') {
262262
this.input.value = parseInt(this.input.min);
263263
}
264264
}

0 commit comments

Comments
 (0)