Skip to content

Commit

Permalink
respond to code review
Browse files Browse the repository at this point in the history
  • Loading branch information
eluberoff committed Feb 4, 2025
1 parent cdfa690 commit 0737790
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ For example, [Desmos](https://www.desmos.com/calculator) substitutes `<textarea
Sets a tabindex on the field, following the standard spec. When tabindex is -1,
the math field is not part of the page's tab order. Despite that, the math field can still be focused when selected by a mouse.

Static math fields default to `tabindex: -1`, Editable math fields default to `tabindex: 1`.
Static math fields default to `tabindex: -1`, Editable math fields default to `tabindex: 0`.

## disableAutoSubstitutionInSubscripts

Expand Down
11 changes: 4 additions & 7 deletions src/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,17 @@ class ControllerBase {
return this;
}
setAriaLabel(ariaLabel: string) {
var oldAriaLabel = this.getAriaLabel();
if (ariaLabel === oldAriaLabel) return this;
if (ariaLabel && typeof ariaLabel === 'string' && ariaLabel !== '') {
this.ariaLabel = ariaLabel;
} else if (this.editable) {
const oldAriaLabel = this.getAriaLabel();
if (!ariaLabel && this.editable) {
this.ariaLabel = 'Math Input';
} else {
this.ariaLabel = '';
this.ariaLabel = ariaLabel;
}
// If this field doesn't have focus, update its computed mathspeak value.
// We check for focus because updating the aria-label attribute of a focused element will cause most screen readers to announce the new value (in our case, label along with the expression's mathspeak).
// If the field does have focus at the time, it will be updated once a blur event occurs.
// Unless we stop using fake text inputs and emulating screen reader behavior, this is going to remain a problem.
if (this.ariaLabel !== oldAriaLabel && !this.containerHasFocus()) {
if (ariaLabel !== oldAriaLabel && !this.containerHasFocus()) {
this.updateMathspeak();
}
return this;
Expand Down

0 comments on commit 0737790

Please sign in to comment.