Skip to content

Commit

Permalink
Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
m-akinc committed May 21, 2024
1 parent 3ff07ff commit c94b78a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions packages/nimble-components/src/checkbox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ export class Checkbox extends FoundationCheckbox {
/**
* @internal
*/
public getEffectiveTabIndex(): number | null {
// prettier-ignore
return this.disabled ? null : (this.tabIndex ?? 0);
public get resolvedTabIndex(): string | undefined {
const tabIndex = this.tabIndex ?? 0;
return this.disabled ? undefined : tabIndex.toString();
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/nimble-components/src/checkbox/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CheckboxOptions
aria-required="${x => x.required}"
aria-disabled="${x => x.disabled}"
aria-readonly="${x => x.readOnly}"
tabindex="${x => x.getEffectiveTabIndex()}"
tabindex="${x => x.resolvedTabIndex}"
@keypress="${(x, c) => x.keypressHandler(c.event as KeyboardEvent)}"
@click="${(x, c) => x.clickHandler(c.event as MouseEvent)}"
class="${x => (x.readOnly ? 'readonly' : '')} ${x => (x.checked ? 'checked' : '')} ${x => (x.indeterminate ? 'indeterminate' : '')}"
Expand Down
6 changes: 3 additions & 3 deletions packages/nimble-components/src/toggle-button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ export class ToggleButton extends FoundationSwitch implements ButtonPattern {
/**
* @internal
*/
public getEffectiveTabIndex(): number | null {
// prettier-ignore
return this.disabled ? null : (this.tabIndex ?? 0);
public get resolvedTabIndex(): string | undefined {
const tabIndex = this.tabIndex ?? 0;
return this.disabled ? undefined : tabIndex.toString();
}
}
applyMixins(ToggleButton, StartEnd, DelegatesARIAButton);
Expand Down
2 changes: 1 addition & 1 deletion packages/nimble-components/src/toggle-button/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ButtonOptions
<div
role="button"
part="control"
tabindex="${x => x.getEffectiveTabIndex()}"
tabindex="${x => x.resolvedTabIndex}"
@keypress="${(x, c) => x.keypressHandler(c.event as KeyboardEvent)}"
@click="${(x, c) => x.clickHandler(c.event as MouseEvent)}"
class="control ${x => (x.checked ? 'checked' : '')}"
Expand Down

0 comments on commit c94b78a

Please sign in to comment.