Skip to content
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

Add instructions to d2l-input-text. #3864

Merged
merged 5 commits into from
Jul 31, 2023

Conversation

dbatiste
Copy link
Contributor

DE53316

This PR adds the control-instructions advanced property to the d2l-input-text component which wires the tooltip directly up to the input via aria-describedby. It also updates d2l-input-date to provide the control-instructions property instead of rendering a disconnected flakey tooltip for improved accessibility.

This does not remove the description property from d2l-input-text - that is a separate set of work as mentioned in the Rally ticket.

@dbatiste dbatiste requested a review from a team as a code owner July 28, 2023 18:30
@github-actions
Copy link
Contributor

Thanks for the PR! 🎉

We've deployed an automatic preview for this PR - you can see your changes here:

URL https://pr-3864-brightspace-ui-core.d2l.dev/

Note
The build needs to finish before your changes are deployed.
Changes to the PR will automatically update the instance.

// this tooltip is using "announced" since we don't want aria-describedby wire-up which would bury the message in VoiceOver's More Content Available menu
tooltip = html`<d2l-tooltip state="error" announced align="start">${this.validationError} <span class="d2l-offscreen">${this.description}</span></d2l-tooltip>`;
} else if (this.controlInstructions) {
tooltip = html`<d2l-tooltip align="start" for="${this._inputId}" delay="1000">${this.controlInstructions}</d2l-tooltip>`;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike the error d2l-tooltip above, the offscreen description is not included in this tooltip since our intention is that it description will be removed from d2l-input-text. I've left that description in place because removing description will be a separate set of work.

Also, we do not use announced here because we want direct tooltip wire-up using aria-describedby (we're "ok" with these control instructions being buried in VoiceOver's "More Content Available" menu.

@github-actions
Copy link
Contributor

Visual diff tests failed - pull request #3865 has been opened with the updated goldens.

components/inputs/demo/input-text.html Outdated Show resolved Hide resolved
components/inputs/docs/input-text.md Outdated Show resolved Hide resolved
Copy link
Member

@dlockhart dlockhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@dbatiste dbatiste changed the title Add control-instructions to d2l-input-text. Add instructions to d2l-input-text. Jul 31, 2023
@@ -63,11 +63,14 @@ describe('d2l-input-date-range', () => {

async function getRectInnerTooltip(page, selector, inputDateSelector) {
return page.$eval(selector, (elem, inputDateSelector) => {
let content = window.querySelectorComposed(elem.shadowRoot, 'd2l-tooltip[showing]');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this works I will clean this up and use the same solution in the other two places that do the same thing. Unless of course there is a better approach. My goal here is to update the test so that it doesn't need to know which component is responsible for the tooltip. This method just needs to locate the tooltip being displayed so that it can calculate the correct dimensions for the screenshot.

export function getRectTooltip(page, selector, tooltipIndex) {
return page.$eval(selector, (elem, tooltipIndex) => {
const content = elem.shadowRoot.querySelectorAll('d2l-tooltip')[tooltipIndex ? tooltipIndex : 0];
export function getRectTooltip(page, selector) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This more generic version replaces the other two versions that are being removed.

@dbatiste dbatiste merged commit a12e0da into main Jul 31, 2023
5 checks passed
@dbatiste dbatiste deleted the dbatiste/input-text-control-instructions branch July 31, 2023 18:43
@ghost
Copy link

ghost commented Jul 31, 2023

🎉 This PR is included in version 2.137.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ghost ghost added the released label Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants