-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TransferList.Toolbar
implements toolbar pattern (#2274)
- Loading branch information
1 parent
1b654e6
commit 7f1bb28
Showing
8 changed files
with
102 additions
and
5 deletions.
There are no files selected for viewing
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,5 @@ | ||
--- | ||
'@itwin/itwinui-react': patch | ||
--- | ||
|
||
`TransferList.Toolbar` implements the previously missing [toolbar pattern](https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/), including the arrow-key navigation functionality. |
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,5 @@ | ||
--- | ||
'@itwin/itwinui-react': patch | ||
--- | ||
|
||
`IconButton`s inside `TransferList.Toolbar` will now show tooltips on the right side by default to avoid obscuring adjacent buttons in the group. This placement can be changed using the `labelProps.placement` prop on the `IconButton`. |
Binary file modified
BIN
+188 Bytes
(100%)
...act-workshop/cypress-visual-screenshots/baseline/TransferList.test.ts-Basic.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+168 Bytes
(100%)
...orkshop/cypress-visual-screenshots/baseline/TransferList.test.ts-With Label.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,5 @@ | ||
import { TransferListMainExample } from 'examples'; | ||
|
||
export default function Page() { | ||
return <TransferListMainExample />; | ||
} |
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,56 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test.describe('toolbar pattern in TransferList.Toolbar', () => { | ||
test('should support toolbar arrow-key keyboard navigation', async ({ | ||
page, | ||
}) => { | ||
await page.goto('/TransferList'); | ||
const listboxes = page.getByRole('listbox'); | ||
const toolbar = page.getByRole('toolbar'); | ||
const buttons = toolbar.first().locator('button'); | ||
|
||
await page.keyboard.press('Tab'); | ||
await expect(listboxes.first()).toBeFocused(); | ||
|
||
await page.keyboard.press('Tab'); | ||
await expect(buttons.nth(0)).toBeFocused(); | ||
await page.keyboard.press('ArrowDown'); | ||
await expect(buttons.nth(1)).toBeFocused(); | ||
await page.keyboard.press('ArrowDown'); | ||
await expect(buttons.nth(2)).toBeFocused(); | ||
await page.keyboard.press('ArrowDown'); | ||
await expect(buttons.nth(3)).toBeFocused(); | ||
await page.keyboard.press('ArrowDown'); | ||
await expect(buttons.nth(0)).toBeFocused(); | ||
await page.keyboard.press('ArrowUp'); | ||
await expect(buttons.nth(3)).toBeFocused(); | ||
}); | ||
|
||
test('should have only one tab stop and support Tab/Shift+Tab key navigation', async ({ | ||
page, | ||
}) => { | ||
await page.goto('/TransferList'); | ||
const listboxes = page.getByRole('listbox'); | ||
const toolbar = page.getByRole('toolbar'); | ||
const buttons = toolbar.first().locator('button'); | ||
|
||
await page.keyboard.press('Tab'); | ||
await expect(listboxes.first()).toBeFocused(); | ||
|
||
await page.keyboard.press('Tab'); | ||
await expect(buttons.first()).toBeFocused(); | ||
|
||
await page.keyboard.press('Tab'); | ||
await expect(listboxes.last()).toBeFocused(); | ||
|
||
await page.keyboard.down('Shift'); | ||
await page.keyboard.press('Tab'); | ||
await page.keyboard.up('Shift'); | ||
await expect(buttons.first()).toBeFocused(); | ||
|
||
await page.keyboard.down('Shift'); | ||
await page.keyboard.press('Tab'); | ||
await page.keyboard.up('Shift'); | ||
await expect(listboxes.first()).toBeFocused(); | ||
}); | ||
}); |