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

Global search - keyboard + hiding #1416

Merged
merged 1 commit into from Feb 9, 2016
Merged

Conversation

anselmbradford
Copy link
Member

Changes

  • Updates Global search to:
    • Handle tabbing through the search
    • Clicking off the search box to close it.
    • Add basic no-js state.

Testing

  • gulp build

Keyboard:

  • Resize to mobile size.
  • tab through to highlight search magnifying glass, continue tabbing to pass by hidden search input.
  • click in beta banner.
  • tab through to highlight search magnifying glass.
  • Press spacebar to expand menu.
  • Press tab to tab off of global search and observe it closes.
  • Repeat for desktop

Mouse:

  • Resize to mobile size.
  • Click magnifying glass to expand search.
  • Click off global search element to close it.
  • Repeat for desktop.

Review

Screenshots

search

Todos

  • Basic no-js state is present but stacking and padding will need to be added when no-js hamburger menu is added.

@@ -267,6 +258,22 @@
} );
}

.m-global-search {
// Tab trigger is used to capture press of the tab key so that
// global search can be collapsed when it hits this element.
Copy link
Contributor

Choose a reason for hiding this comment

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

Just so I'm clear, the user tabs through the entire menu, would normally tab to the next item after the menu, but instead hits this hidden tab-trigger, which has an event observer that in turn closes the menu?

Copy link
Member Author

Choose a reason for hiding this comment

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

That is correct. I guess it's a little weird in that after the menu closes the focus jumps back up to the beginning of the page. Not sure if that's an issue as it's still all tab-accessible (e.g. after collapsing, continue tabbing through the page past the search button). Perhaps focus should jump back to the closed search button? I'll push a fix for this.

This approach is to avoid a lot of complicated logic on tabbing behavior. The search box needs to close after tabbing from the search button at desktop and mobile size, but needs to instead close after the last of the suggested topics links at tablet size. I believe once the bewd-side comes in, the suggested topics links will not be static. Therefore there'd need to be logic around adding and removing events at different breakpoints and on the bewd-side to identify the last link, if present.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in 2c8ab80

Copy link
Contributor

Choose a reason for hiding this comment

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

I like it, it's a smart work around to a wicked complicated set of interactions. Nice work!

@jimmynotjim
Copy link
Contributor

Should there be an animation on desktop-ish sizes? It looks like it just jumps from closed to open and in reverse.

@sebworks
Copy link
Contributor

sebworks commented Feb 8, 2016

ditto Jimmys comment about animating on desktop.

@KimberlyMunoz
Copy link
Contributor

tab through to highlight search magnifying glass, continue tabbing to pass by hidden search input.

This step is technically a WCAG failure, but I don't think your PR introduced it.

Clicking on the menu, then clicking on the search icon shows no visible changes. When I click on the menu "x" both things are dismissed, making it seem like the search never appeared. It might be worth talking with UX about this interaction because I think it could be fixed a couple ways.

The search box toggle works really well on Voiceover and through keyboard tabbing.

@anselmbradford
Copy link
Member Author

Should there be an animation on desktop-ish sizes? It looks like it just jumps from closed to open and in reverse.

Fixed in ca0e092

Clicking on the menu, then clicking on the search icon shows no visible changes. When I click on the menu "x" both things are dismissed, making it seem like the search never appeared. It might be worth talking with UX about this interaction because I think it could be fixed a couple ways.

These will slide back and forth. Search from the right, mega menu from the left. I just tried to isolate the global search behavior here and haven't included the mega menu behavior.

var _triggerSel = '.' + BASE_CLASS + '_trigger';
var _triggerDom = _dom.querySelector( _triggerSel );
var _flyoutMenu = new FlyoutMenu( _dom,
_triggerSel,
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably better to place one new line.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed in b23f666

@sebworks
Copy link
Contributor

sebworks commented Feb 9, 2016

Looks good. 👍 . It doesn't always animate out when tabbing on mobile, but maybe that can be addressed later.

markup: |
<h1>
<a href="#">
<span class="u-invisible">Not shown</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this class be on the a? Cause that'll still be in the tab index.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in d152faa

@anselmbradford
Copy link
Member Author

It doesn't always animate out when tabbing on mobile, but maybe that can be addressed later.

Yeah, I have a poorly worded todo for that here. Looks like it's a reflow issue again. It may be worth trying an animation instead of a transition and see if there's a difference.

@jimmynotjim
Copy link
Contributor

👍

@KimberlyMunoz
Copy link
Contributor

👍

anselmbradford added a commit that referenced this pull request Feb 9, 2016
Global search - keyboard + hiding
@anselmbradford anselmbradford merged commit 5af38d8 into flapjack Feb 9, 2016
@anselmbradford anselmbradford deleted the global_search_fixes branch February 9, 2016 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants