Skip to content

Commit

Permalink
fix(datatable): remove toolbar search and menu from tab order (#14397)
Browse files Browse the repository at this point in the history
* fix(datatable): remove toolbar search and menu from tab order when batch actions are open

* chore: update snaps
  • Loading branch information
tay1orjones committed Aug 4, 2023
1 parent f389dfa commit b7abe20
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
2 changes: 0 additions & 2 deletions e2e/components/DataTable/DataTable-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ test.describe('DataTable @avt', () => {
await page.keyboard.press('Shift+Tab');
await page.keyboard.press('Shift+Tab');
await page.keyboard.press('Shift+Tab');
await page.keyboard.press('Shift+Tab');
await page.keyboard.press('Shift+Tab');

await page
.getByRole('heading', { name: 'Expandable row content' })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ exports[`DataTable behaves as expected selection should render and match snapsho
id="custom-id"
placeholder="Filter table"
role="searchbox"
tabindex="0"
type="text"
value=""
/>
Expand Down Expand Up @@ -941,6 +942,7 @@ exports[`DataTable renders as expected - Component API should render and match s
id="custom-id"
placeholder="Filter table"
role="searchbox"
tabindex="0"
type="text"
value=""
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ exports[`TableToolbarSearch renders as expected - Component API should render 1`
id="custom-id"
placeholder="Filter table"
role="searchbox"
tabindex="0"
type="text"
value=""
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,16 @@ export const Default = () => {
</TableBatchAction>
</TableBatchActions>
<TableToolbarContent>
<TableToolbarSearch onChange={onInputChange} />
<TableToolbarMenu>
<TableToolbarSearch
tabIndex={
batchActionProps.shouldShowBatchActions ? -1 : 0
}
onChange={onInputChange}
/>
<TableToolbarMenu
tabIndex={
batchActionProps.shouldShowBatchActions ? -1 : 0
}>
<TableToolbarAction onClick={this.handleOnRowAdd}>
Add row
</TableToolbarAction>
Expand Down Expand Up @@ -328,8 +336,14 @@ export const Playground = (args) => {
action('TableToolbarSearch - onChange')(evt);
onInputChange(evt);
}}
tabIndex={
batchActionProps.shouldShowBatchActions ? -1 : 0
}
/>
<TableToolbarMenu>
<TableToolbarMenu
tabIndex={
batchActionProps.shouldShowBatchActions ? -1 : 0
}>
<TableToolbarAction
onClick={(evt) => {
action('handleOnRowAdd')(evt);
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(function Search(
{labelText}
</label>
<input
{...rest}
autoComplete={autoComplete}
className={`${prefix}--search-input`}
defaultValue={defaultValue}
Expand All @@ -257,6 +256,7 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(function Search(
type={type}
value={value}
tabIndex={onExpand && !isExpanded ? -1 : undefined}
{...rest}
/>
<button
aria-label={closeButtonLabelText}
Expand Down

0 comments on commit b7abe20

Please sign in to comment.