-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support tabindex overriding for Button, MenuButton, ToggleButton, Che…
…ckbox, and Anchor (#2110) # Pull Request ## 🤨 Rationale Fixes #2094 ## 👩💻 Implementation For each of `Button`, `MenuButton`, `ToggleButton`, 'Checkbox', and `Anchor`, added `tabindex` attribute, updated the template to forward the `tabindex` value, and wrote automated tests. Additionally for `Button` and `Checkbox`, forked template from FAST and copied over the FAST tests. ## 🧪 Testing Ran tests. Manually tested in Storybook in Chrome and Firefox. ## ✅ Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed. --------- Co-authored-by: Milan Raj <rajsite@users.noreply.github.com>
- Loading branch information
Showing
20 changed files
with
1,481 additions
and
20 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@ni-nimble-components-573fc816-eaa7-4e07-b0ef-8bfd5ccff19e.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Support tabindex overriding for Button, MenuButton, ToggleButton, Checkbox, and Anchor", | ||
"packageName": "@ni/nimble-components", | ||
"email": "7282195+m-akinc@users.noreply.github.com", | ||
"dependentChangeType": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { html, ref, slotted } from '@microsoft/fast-element'; | ||
import type { ViewTemplate } from '@microsoft/fast-element'; | ||
import { | ||
ButtonOptions, | ||
endSlotTemplate, | ||
FoundationElementTemplate, | ||
startSlotTemplate | ||
} from '@microsoft/fast-foundation'; | ||
import type { Button } from '.'; | ||
|
||
export const template: FoundationElementTemplate< | ||
ViewTemplate<Button>, | ||
ButtonOptions | ||
> = (context, definition) => html` | ||
<button | ||
class="control" | ||
part="control" | ||
?autofocus="${x => x.autofocus}" | ||
?disabled="${x => x.disabled}" | ||
form="${x => x.formId}" | ||
formaction="${x => x.formaction}" | ||
formenctype="${x => x.formenctype}" | ||
formmethod="${x => x.formmethod}" | ||
formnovalidate="${x => x.formnovalidate}" | ||
formtarget="${x => x.formtarget}" | ||
name="${x => x.name}" | ||
type="${x => x.type}" | ||
value="${x => x.value}" | ||
tabindex="${x => x.tabIndex}" | ||
aria-atomic="${x => x.ariaAtomic}" | ||
aria-busy="${x => x.ariaBusy}" | ||
aria-controls="${x => x.ariaControls}" | ||
aria-current="${x => x.ariaCurrent}" | ||
aria-describedby="${x => x.ariaDescribedby}" | ||
aria-details="${x => x.ariaDetails}" | ||
aria-disabled="${x => x.ariaDisabled}" | ||
aria-errormessage="${x => x.ariaErrormessage}" | ||
aria-expanded="${x => x.ariaExpanded}" | ||
aria-flowto="${x => x.ariaFlowto}" | ||
aria-haspopup="${x => x.ariaHaspopup}" | ||
aria-hidden="${x => x.ariaHidden}" | ||
aria-invalid="${x => x.ariaInvalid}" | ||
aria-keyshortcuts="${x => x.ariaKeyshortcuts}" | ||
aria-label="${x => x.ariaLabel}" | ||
aria-labelledby="${x => x.ariaLabelledby}" | ||
aria-live="${x => x.ariaLive}" | ||
aria-owns="${x => x.ariaOwns}" | ||
aria-pressed="${x => x.ariaPressed}" | ||
aria-relevant="${x => x.ariaRelevant}" | ||
aria-roledescription="${x => x.ariaRoledescription}" | ||
${ref('control')} | ||
> | ||
${startSlotTemplate(context, definition)} | ||
<span class="content" part="content"> | ||
<slot ${slotted('defaultSlottedContent')}></slot> | ||
</span> | ||
${endSlotTemplate(context, definition)} | ||
</button> | ||
`; |
Oops, something went wrong.