Repository navigation
Fix contrast of keyboard focus indicator on card action buttons #5879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bf0c7c0
d7ee018
82c049f
0b535da
9a65306
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
compulim marked this conversation as resolved.
|
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems the new styling didn't help here much.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <!doctype html> | ||
| <html> | ||
| <head> | ||
| <script> | ||
| location = './heroCard.pushButton.focusVisible?variant=fluent'; | ||
| </script> | ||
| </head> | ||
| <body></body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| <!doctype html> | ||
| <html lang="en-US"> | ||
| <head> | ||
| <link href="/assets/index.css" rel="stylesheet" type="text/css" /> | ||
| </head> | ||
| <body> | ||
| <main id="webchat"></main> | ||
| <script type="importmap"> | ||
| { | ||
| "imports": { | ||
| "@testduet/wait-for": "https://esm.sh/@testduet/wait-for", | ||
| "botframework-webchat": "/__dist__/packages/bundle/static/botframework-webchat.js", | ||
| "botframework-webchat/": "/__dist__/packages/bundle/static/botframework-webchat/", | ||
| "botframework-webchat-fluent-theme": "/__dist__/packages/fluent-theme/static/botframework-webchat-fluent-theme.js", | ||
| "react": "/__dist__/packages/bundle/static/react.js", | ||
| "react-dom": "/__dist__/packages/bundle/static/react-dom.js", | ||
| "react-dom/client": "/__dist__/packages/bundle/static/react-dom/client.js" | ||
| } | ||
| } | ||
| </script> | ||
| <script type="module"> | ||
| import '/test-harness.mjs'; | ||
| import '/test-page-object.mjs'; | ||
|
|
||
| import { waitFor } from '@testduet/wait-for'; | ||
| import { createStoreWithOptions, ReactWebChat } from 'botframework-webchat'; | ||
| import { FluentThemeProvider } from 'botframework-webchat-fluent-theme'; | ||
| import { createElement } from 'react'; | ||
| import { createRoot } from 'react-dom/client'; | ||
|
|
||
| // TODO: This is for `createDirectLineEmulator` only, should find ways to eliminate this line. | ||
| window.WebChat = { createStoreWithOptions }; | ||
|
|
||
| run(async function () { | ||
| const { directLine, store } = testHelpers.createDirectLineEmulator(); | ||
| const variant = new URLSearchParams(location.search).get('variant'); | ||
| const webChatElement = createElement(ReactWebChat, { directLine, store }); | ||
|
|
||
| createRoot(document.getElementById('webchat')).render( | ||
| variant ? createElement(FluentThemeProvider, { variant }, webChatElement) : webChatElement | ||
| ); | ||
|
|
||
| await pageConditions.uiConnected(); | ||
|
|
||
| // Same as the "carousel" command of the mock bot. | ||
| await directLine.emulateIncomingActivity({ | ||
| attachmentLayout: 'carousel', | ||
| attachments: [1, 2, 3].map(index => ({ | ||
| content: { | ||
| buttons: [ | ||
| { title: 'Places To Buy', type: 'imBack', value: 'Place to buy' }, | ||
| { title: 'Related Products', type: 'imBack', value: 'Related Products' } | ||
| ], | ||
| subtitle: 'This is the subtitle', | ||
| text: 'Price: $XXX.XX USD', | ||
| title: `Details about image ${index}` | ||
| }, | ||
| contentType: 'application/vnd.microsoft.card.hero' | ||
| })), | ||
| from: { role: 'bot' }, | ||
| type: 'message' | ||
| }); | ||
|
|
||
| await pageConditions.numActivitiesShown(1); | ||
|
|
||
| const placesToBuyButton = document.querySelector('.carousel-layout .ac-pushButton'); | ||
|
|
||
| // WHEN: Focus on the first attachment of the carousel via keyboard. | ||
| pageObjects.focusTranscript(); | ||
| await host.sendKeys('ENTER'); | ||
|
|
||
| // WHEN: Press TAB to move focus to the "Places To Buy" button. | ||
| await host.sendTab(); | ||
|
|
||
| // THEN: The "Places To Buy" button should be focused. | ||
| expect(document.activeElement).toBe(placesToBuyButton); | ||
| expect(placesToBuyButton.textContent).toBe('Places To Buy'); | ||
|
|
||
| // THEN: The button should show a two-tone focus indicator: a black ring and a white inner band. | ||
| await pageConditions.scrollStabilized(); | ||
| await host.snapshot('local'); | ||
|
|
||
| // WHEN: Press ENTER to press the "Places To Buy" button. | ||
| (await directLine.actPostActivity(() => host.sendKeys('ENTER'))).resolveAll(); | ||
|
|
||
| await pageConditions.numActivitiesShown(2); | ||
| await pageConditions.allOutgoingActivitiesSent(); | ||
|
|
||
| // THEN: The "Places To Buy" button should be pressed and keep the focus. | ||
| await waitFor(() => expect(placesToBuyButton.getAttribute('aria-pressed')).toBe('true')); | ||
| expect(document.activeElement).toBe(placesToBuyButton); | ||
|
|
||
| // THEN: The white inner band should separate the black ring from the pressed button (blue). | ||
| await pageConditions.scrollToBottomCompleted(); | ||
| await host.snapshot('local'); | ||
| }); | ||
| </script> | ||
| </body> | ||
| </html> |
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is thicker, black border in white label. It's inconsistent with the above blue border on active button. We should reconcile favoring this one. Seems:
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
Uh oh!
There was an error while loading. Please reload this page.