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

[5.x]: Using enter/spacebar to activate breadcrumb links inside disclosures closes the menu #14598

Closed
gcamacho079 opened this issue Mar 14, 2024 · 3 comments
Assignees
Labels

Comments

@gcamacho079
Copy link
Contributor

What happened?

Description

See title

Steps to reproduce

  1. Open a menu inside the global breadcrumb navigation (to choose a site or section)
  2. Use enter/spacebar to activate a link

Expected behavior

The user should go to the page selected

Actual behavior

The disclosure menu closes

Craft CMS version

5.0.0-beta.6

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@brianjhanson brianjhanson self-assigned this Mar 14, 2024
@brianjhanson
Copy link
Contributor

brianjhanson commented Mar 14, 2024

@gcamacho079 things seem to work with enter for me, just not space. Should both trigger the navigation?

Edit: It looks like we rely on default browser behavior for following those links so I created a little test. It appears as though with a normal list of links enter will follow the links while space does nothing. I'm happy to tweak it, just trying to make sure I understand the desired behavior.

https://codepen.io/brianjhanson/pen/abxmLpp

@gcamacho079
Copy link
Contributor Author

gcamacho079 commented Mar 14, 2024

I may not have pulled recent changes, but that (Enter only for link activation) is indeed the native behavior. Our disclosures get tricky because some of our menus mix links and buttons, and it’s impossible to tell which you’re on. For example, in element action disclosures, we have a button to “Open in Image Editor” near a link to “Show in folder”. So for some of those menus, you could use Space to activate the buttons, but that would not work for a link.

If we use the activate in instances like these, we’ll ensure both Enter/Space activate them and eliminate some of the guesswork about which key to use.

@brandonkelly
Copy link
Member

I was on the fence about this because it felt a little weird to add a keypress listener to disclosure link items that were really just normal hyperlinks, but I agree it’s confusing since they are styled like other disclosure items. Just added the listener for the next release.

Note that for links with target="_blank", the browser might end up blocking the new tab until you allow it.

Screenshot of a message in Firefox about a new tab getting blocked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants