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

When toggling Demo Banner, do not send focus to a new location outside of the sign-in page forms #7932

Conversation

apurva-modi
Copy link
Contributor

Recorded the previous element that holds focus before the close button is clicked and transfer focus to that element once the header is dismissed

7661-demo

Contributor Checklist

PR process:

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Testing:

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

Reviewer Checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@apurva-modi apurva-modi changed the base branch from release-v0.14.x to develop March 29, 2021 20:17
@jonboiser jonboiser self-assigned this Mar 29, 2021
methods: {
toggleBanner() {
this.bannerClosed = !this.bannerClosed;
this.previouslyFocusedElement.focus();
Copy link
Contributor

Choose a reason for hiding this comment

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

Put a guard here, since it's possible that this.previouslyFocusedElement is undefined.

},
focusChange(e) {
// We need the element prior to the close button
if (this.$refs.close_button && e.target != this.$refs.close_button.$el) {
Copy link
Contributor

@jonboiser jonboiser Mar 29, 2021

Choose a reason for hiding this comment

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

This extra check for $refs.close_button can make this feature a little confusing. For example, if I do this:

  1. At Sign-In screen, click "Close" on demo bar right away.
  2. Use my keyboard to focus on the "Create Account" button
  3. Press "More info" on demo bar
  4. Then focus returns to the username bar.

Do you think you can update this to always have this behavior:

Given The demo banner is in closed state
When I focus on an element `$el` on the sign-in page
	And I re-open the demo banner
	And I re-close the demo banner
	Then focus is returned to `$el`.

Here's a video of the scenario above.

CleanShot 2021-03-29 at 13 55 14

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay I understood I will do it.

… info banner button is clicked and transfer focus to that element once the header is dismissed.
@apurva-modi apurva-modi force-pushed the 7661-Demo-site-header-focus-issue branch from a8c1e73 to dfd7a9b Compare April 6, 2021 20:03
@jonboiser jonboiser changed the title 7661 demo site header focus issue When toggling Demo Banner, do not send focus to a new location outside of the form Apr 7, 2021
Copy link
Contributor

@jonboiser jonboiser left a comment

Choose a reason for hiding this comment

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

Looks good!

@jonboiser jonboiser changed the title When toggling Demo Banner, do not send focus to a new location outside of the form When toggling Demo Banner, do not send focus to a new location outside of the sign-in page forms Apr 7, 2021
@jonboiser jonboiser added the changelog Important user-facing changes label Apr 7, 2021
@jonboiser jonboiser merged commit 7f76b3b into learningequality:develop Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog Important user-facing changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Closing the demo banner does not return focus to the username/password field on the Sign In Page
2 participants