Updated as of #66

This issue is a blocker for putting Navigation into the Standard profile.

Problem/Motivation

When using the mobile version of the navigation, it is possible to tab through the admin navigation, and into the content of the page.

This violates WCAG 2.4.7 focus visible, because the content item that has focus will be obscured by the navigation menu.

Steps to reproduce

  1. Enable the Navigation module.
  2. Log in as admin.
  3. Reduce the viewport width until the Navigation "Expand sidebar" button appears at top-left.
  4. Activate the "Expand sidebar" button to open the sidebar.
  5. Press the TAB key until the focus moves off the end of the sidebar.
Expected behavior

After moving off the end of the sidebar, the focus moves off the page onto the browser UI.

Actual behavior

The focus continues to move through elements in the page content, some of which are hidden by the sidebar.

Proposed resolution

  • When the "mobile" Navigation sidebar is expanded, add inert to elements outside of the sidebar.
  • When the sidebar is closed, remove inert from those elements.

Remaining tasks

  1. Screenshots for issue summary.
  2. Maintainer review.
  3. #3572169: Put the mobile sidebar close button into the TAB sequence
  4. #3572628: Mobile sidebar should close by ESCAPE key
  5. Tests.

User interface changes

Elements outside of the Navigation sidebar will be inert and not in the tab sequence.

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3443571

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mherchel created an issue. See original summary.

mherchel’s picture

Title: Mobile version should have focus trap » Mobile version of Navigation should have focus trap
ckrina’s picture

Project: Navigation » Drupal core
Version: master » 11.x-dev
Component: Code » navigation.module
ckrina’s picture

Issue tags: +Portland2024
katannshaw’s picture

I agree with mherchel that when a user enters the mobile nav, keyboard focus must be trapped within it until the user:

* Selects the Close/OK/X button
* Selects the ESC key
* Clicks outside of the menu with their mouse

However I disagree on the WCAG success criteria that this violates. I believe that this violates 2.1.2 No Keyboard Trap (Level A). Under an example in this SC titled "A modal dialog box", it mentions:

A Web application brings up a dialog box. At the bottom of the dialog are two buttons, Cancel and OK. When the dialog has been opened, focus is trapped within the dialog; tabbing from the last control in the dialog takes focus to the first control in the dialog. The dialog is dismissed by activating the Cancel button or the OK button.

The WCAG 2.4.7 Focus Visible (Level AA) SC refers to the visible focus indicator for focusable elements.

I like Mike's idea.

finnsky’s picture

Probably it is possible to merge that core/misc/focus-trap.js logic with existing arrow navigation:

https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/navig...

Or move it on core level out of module.

mherchel’s picture

Status: Active » Needs review

Or move it on core level out of module.

Yeah, this is my thought. In the MR above, I abstracted it to be on the core level, and then make use of it in both navigation and olivero (to show that it can be used in multiple places).

mherchel’s picture

Issue summary: View changes
finnsky’s picture

StatusFileSize
new1.18 MB

imo it should be possible to ignore desktop somehow.

desktop

mherchel’s picture

Status: Needs review » Needs work

imo it should be possible to ignore desktop somehow.

Yeah, that makes sense. Should be doable!

nod_’s picture

Issue tags: +Needs tests

The existing tabbingmanager feature has tests, this one should too

kentr’s picture

I believe this would be SC 2.4.11 Focus Not Obscured (Minimum) (Level AA). It directly addresses user openable, persistent disclosures and uses slide-out navigation as an example.

When the additional content is opened, it takes focus and the tab ring is constrained to the new content until it is dismissed. This modality is somewhat like a dialog, in that a user cannot navigate beyond the opened content by keyboard without dismissing it first (typically by pressing Esc). However, unlike in a modal dialog, in some implementations a pointer user may be able to interact with content outside the opened section without dismissing it. Since this pattern potentially creates an inequitable experience between keyboard and pointer users, it should be used cautiously. That said, it does prevent the opened content from obscuring the keyboard focus in the main content, and thus should pass this SC. This is described and demonstrated in a short video in the Knowbility article in the reference section, under the section heading Keep keyboard focus in the slide-out navigation until it's closed.

mgifford’s picture

Issue tags: +wcag2411

Tagging

catch’s picture

Priority: Normal » Major

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

smustgrave’s picture

Can I ask to help get this through faster that maybe we move the olivero change to a follow up?

kentr’s picture

Rebased.

cwilcox808’s picture

If the "mobile" navigation should be a modal dialog, I think adding keyboard listeners are no longer the way to implement it.

- Hijacking Tab, Shift-Tab prevents keyboard users from navigating to the browser UI while the navigation is open.
- Keyboard listeners don't prevent screen reader users from navigating beyond the navigation.

These were always problems with the keyboard listeners but the alternative was more challenging to implement.

Instead, the mobile navigation should be contained within a <dialog> element that's opened using .showModal(). The dialog will be modal, preventing access to the rest of the page (including by screen readers), while not preventing keyboard access to the browser UI. It closes when the ESC key is pressed or when a close button is used. The close button does not have to be scripted:

<form action="." method="dialog">
  <button>Close</button>
</form>

To close the dialog when a pointer clicks outside of it (aka "light dismiss"), you can use <dialog closedby="any">. closedby is new and not supported in all browsers but it doesn't take many lines of JavaScript to check for support and implement a fallback.

However the dialog is closed, focus will automatically return to the button that opened it.

I would go even further and propose implementing it using the show-modal Invoker command instead, using JavaScript as a fallback in browsers that don't support them (or add the full Invoker command polyfill as a resource any module can use).

mherchel’s picture

Yeah, we don't need to include Olivero here. Back when I posted that I was thinking it would be nice to have an API for that.

smustgrave’s picture

So this is going to be our first "a11y-bugsmash" ONE!

Starting the triage

Can we update the summary to use the standard template. Sounds like agreement for the solution is to keep the scope to the navigation module and only trigger the trap on mobile? Someone correct me if I'm wrong.

Also if possible could we get small gifs of the trap before/after?

For test coverage a javascript test could be added or maybe even just expanding an existing one. Something like

put focus at the top
Doing a loop based on the number of elements (would have to know that) press the tab key
verify focus is still on the top.

mherchel changed the visibility of the branch 3443571-mobile-version-of to hidden.

mherchel’s picture

gonna mess around with this for a bit.

mherchel’s picture

Status: Needs work » Needs review
StatusFileSize
new1.43 KB

This was easier than expected... until I tried to create a new branch. Posted the issue in Drupal Slack #gitlab at https://drupal.slack.com/archives/CGKLP028K/p1770330716822829

In the meantime, I'm attaching a patch like it's 2017! 😎

mherchel’s picture

Status: Needs review » Needs work

Setting back to NW. Its setting inert at wide widths too.

Will get back to this tomorrow.

fjgarlin made their first commit to this issue’s fork.

fjgarlin changed the visibility of the branch main to hidden.

kentr’s picture

@mherchel:

With the patch in #25, the "Skip to main content" link and the "Expand sidebar" button are still focusable when the sidebar is open. So, the focus disappears for a bit when tabbing through them.

Is this expected?

kentr’s picture

I was mistaken. The skip link isn't focusable. But the hidden Expand sidebar button is.

After that, the next item in the ring is the Home Drupalicon button at top-left of sidebar, but it doesn't have a focus indicator.

To me, the Expand sidebar button shouldn't be tab-able when the sidebar is open, because it's hidden and there is a close button.

I also think the sidebar should be closable with the ESCAPE key and that the close button should be tab-able. But those are separate issues.

kentr’s picture

The three vertical dots menu toggle button (top-right of screen) is also tab-able with the sidebar open. Seems like it shouldn't be.

mherchel’s picture

Good catches. Will look at this!

smustgrave’s picture

Just going to chime in if we can still update the summary and track open questions in th remaining tasks section? May help others

mherchel’s picture

Status: Needs work » Needs review
Issue tags: +Needs followup

OK. Got the MR working and pushed fix so it won't allow the expand toolbar button to be focused.

Note that there's a tabindex="-1" on the close button at mobile. Its being added in core/modules/navigation/layouts/navigation.html.twig

This means there's no way to close (that I can find) via keyboard. We'll need a followup for this

mherchel’s picture

Note that tests are failing because the filesize of the JS changed. I'll fix that once I get signoff from maintainers on the fix.

We'll also need to write some nightwatch tests to cover this. I haven't done that in years 😬

rkoller’s picture

hm i've checked out MR14669 and quickly tested on safari 26.2 on macOS 26.2 as well as latest edge and in each case the focus wasnt trapped within the mobile navigation.

and yep the close button should be reachable by keyboard same as there should be an option to close the mobile navigation by pressing the ESC key. but from my perspective if moved to a follow up those followup(s) and this issue should go into the same new version of drupal.

kentr’s picture

This means there's no way to close (that I can find) via keyboard. We'll need a followup for this

Yeah, I realized this after the fact.

So that we don't cause a regression (removing the only way to close by keyboard), would it be in scope to change the close button in this issue?

kentr’s picture

I'm working on updating the IS.

I think this can be tested with functional javascript.

kentr’s picture

Issue summary: View changes
Issue tags: -Portland2024, -Needs issue summary update

Updated the IS, but still needs screenshots.

Removed Portland2024 tag.

mherchel’s picture

hm i've checked out MR14669 and quickly tested on safari 26.2 on macOS 26.2 as well as latest edge and in each case the focus wasnt trapped within the mobile navigation.

Did you clear your cache? You're able to focus on elements outside of the navigation? Can you post a video?

mherchel’s picture

I just tested Safari, and it seems to be working for me. I'd like to know what elements you're able to focus on too.

cwilcox808’s picture

I made a prototype to demonstrate the approach I've suggested. It uses a modal dialog when the navigation should cover the page. When the viewport is wide enough, it's non-modal and beside the page.

kentr’s picture

There's an effort to use native dialogs throughout core: #2158943: Add a native dialog element to deprecate the jQuery UI dialog.

I wonder if whatever we do with dialog here needs to be coordinated with that effort.

kentr’s picture

@cwilcox808 Nice prototype!

Maybe what we do here will influence that global effort 🙂.

rkoller’s picture

StatusFileSize
new1.71 MB
new275.46 KB

re #41 & #42 recorded one video (no_trap.mp4) clearing the cache again and then tabbing through the interface and recorded a second video (rotor.mp4) with the rotor. the latter illustrates that everything is available in the AOM and therefore in consequence also in the rotor.

smustgrave’s picture

Funny I tested the MR and while tabbing I ended up out of the webpage and tabbing the actual development bar in the browser

mherchel’s picture

@rkoller what browser are you using? I don't know how rotors operate, but this patch doesn't remove anything from the AOM, it just prevents tabbing. Are you able to tab outside if using the keyboard?

I'm curious what happens if you test out Olivero's mobile menu with the rotor. In there, we listen for the tab event and redirect it to the beginning/end as necessary (inert wasn't a thing when that was written).

rkoller’s picture

i am on tahoe 26.2, tested in safari 26.2, and the latest firefox developer edition, and the latest version of edge. in all of them the same result i am able to tab out. and no_trap.mp4 illustrated that, there i'Ve tabbed out with the keyboard.

and testing out oliveros mobile menu, you mean go to for example the front page in olivero? that is what i actually did in the no_trap.mp4 (the behavior on a claro page is identical)

mherchel’s picture

@rkoller

  1. How do I reproduce this with a keyboard? Note that we are not removing the items from the AOM, we're just preventing tabbing to them
  2. Can you reproduce the same with Olivero's mobile menu? If you have Olivero's mobile menu open, can you escape it using the rotor functionality that you're displaying?
rkoller’s picture

StatusFileSize
new223.77 KB

uh now i'Ve realized what you meant with the olivero menu, i was completely on the wrong train of thought. recorded another video (menu.mp4). i've activated keycastr. that way you are able to see which keystrokes were entered. i was only tabbing through the page with a mobile viewport. first opening the navigation sidebar then tabbing on, tabbing out of the navigation sidebar and then when reaching the menu button for olivero opening it and then tabbing within the olivero menu. there in contrast to the navigation sidebar the focus is trapped. hope that helps.

update: also tested the same approach in the latest safari technology preview, firefox developer edition, and edge, and in all three the same behavior like illustrated in the menu.mp4 video for safari 26.2

mherchel’s picture

It looks like you're hitting the arrow-right key instead of tabbing. Am I looking at this correctly?

mherchel’s picture

Also, I see youre hitting CMD+R. What is that?

I'm trying to figure out how to reproduce.

rkoller’s picture

StatusFileSize
new67.04 KB

nope that is the tab key in keycastr,. arrows would look like that: arrows.mp4

and cmd-r is simply reloading the page so the tabbing starts from the top of the DOM.

mherchel’s picture

Gotcha. I'm still confused why this wouldn't be working for you.

rkoller’s picture

StatusFileSize
new784.84 KB

i guess i found one interesting detail, checkout aggregation.mp4 (recorded in edge)

first with the aggregation turned on (that was the case for me in previous videos) when i go to the front page and tab i tab through the navigation sidebar and onto the front page and am able to to expand also the olivero nav. then i go back to the aggregation page and deactivate aggregation. when i then go to the front page the focus is trap. but as you notice i experience the same like @smustgrave in #46, when the end of the navigation sidebar is reached instead of jumping directly to the top of the sidebar again the tab order takes a detour to the toolbar of the browser.

kentr’s picture

i experience the same like @smustgrave in #46, when the end of the navigation sidebar is reached instead of jumping directly to the top of the sidebar again the tab order takes a detour to the toolbar of the browser.

From my interpretation of #19, this is preferred.

Sounds like we don't want to prevent users from getting to the browser UI via keyboard, and that we don't really want a "trap".

mherchel’s picture

navigation sidebar is reached instead of jumping directly to the top of the sidebar again the tab order takes a detour to the toolbar of the browser

Yeah thats perfectly fine. The point is to not to be able to focus elements that are currently hidden.

You likely needed to clear your cache after enabling aggregation. This makes a lot more sense.

kentr’s picture

kentr’s picture

Issue tags: +Portland2024

TIL we're not supposed to remove event-related tags when the event is over, unless no one from the event actually worked on the issue.

finnsky changed the visibility of the branch 3443571-focus-trap to hidden.

smustgrave’s picture

Status: Needs review » Needs work

So seems like this is working as advertised right? Next step would be to get test coverage then. I'm not familiar enough with nightwatch to try that but feel javascript test should be possible too right?

finnsky’s picture

finnsky changed the visibility of the branch 3443571-focus-trap to hidden.

I think my cat wanted to join the Drupal community.

finnsky changed the visibility of the branch 3443571-focus-trap to active.

kentr’s picture

Not sure that the fully native dialog implementation meets Drupal's supported browser requirements, though.

At least, closedby isn't supported on Safari.

mherchel’s picture

Posted question about using inert via redirecting tabs at https://web-a11y.slack.com/archives/C042TSFGN/p1770743434010279

mgifford’s picture

We have to resolve this. This is something that we consider a blocker.

kentr’s picture

Issue summary: View changes
Issue tags: -Needs followup

Added #3572169: Put the mobile sidebar close button into the TAB sequence and #3572628: Mobile sidebar should close by ESCAPE key to the Remaining tasks so that they don't fall through the cracks.

Don't we also need to move focus to the sidebar when it is opened?

mherchel’s picture

Issue tags: -Needs tests

Just pushed some Nightwatch tests.

Disclosure. I used the AI tool Claude Code to write the majority of the test. I then reviewed every line, made some changes, and also ran prettier.

I verified that the tests pass locally, and that if I uncomment out the focus trap JavaScript, the tests fail as expected.

I'm expecting these tests to fail, because of the changes in the JS size. I'll update that test shortly.

mherchel’s picture

Status: Needs work » Needs review

Alright. I updated the ScriptBytes in the tests to account for the additional JS. We should be good.

cwilcox808’s picture

#64 closedby and Invoker commands are not supported by all browsers that meet Drupal's system requirements but polyfills will make them work in browsers that lack native support. (Popovers are supported in all the browsers.)

Because the alternatives all require JavaScript to function, I would expect that including some JavaScript temporarily, until all supported browsers natively support the features, would be acceptable.

My prototype also required JavaScript to fully support the desired behavior but even if no JavaScript is run, the navigation can still be accessed in all supported browsers.

rkoller’s picture

for reference. the issues i had in safari were due to some caching issues. a suggestion by @catch on slack solved the problem. by deleting files/css and files/css the focus remained trapped now consistently in safari, firefox and edge. the sole other nitpick i've raised on slack before, that the focus when it gets into the safari ui aka the addressbar was not visible is also obsolete. after the removal of those two directories and the caches newly generated it is also clearly visible now. so from a functional testing perspective this looks good. and also taking into consideration that the feedback on the a11y slack was also positive and confirming in regard of the approach taken here.

mherchel’s picture

@smustgrave asked me to show the test failures when the JS isn't there. Screenshot and test output below!

  core git:(3443571-focus-trap) ✗ ddev exec "cd core && yarn test:nightwatch modules/navigation/tests/src/Nightwatch/Tests/navigationMobileFocusTrapTest.js"
[dotenv@17.2.3] injecting env (0) from .env -- tip: ✅ audit secrets and track compliance: https://dotenvx.com/ops

[Tests/Navigation Mobile Focus Trap Test] Test Suite
───────────────────────────────────────────────────────────────────────────────
ℹ Connected to selenium-chrome on port 4444 (585ms).
  Using: chrome (138.0.7204.183) on LINUX.

  ℹ Loaded url http://web in 333ms
  ℹ Loaded url http://web/user/reset/1/1770837232/jZpKpfHrlja6Y-_syDPgsXYSNLZ8FWMkl1IrXvO86OM/login
 in 244ms
  ℹ Loaded url http://web/admin/modules in 975ms
  ✔ Element <form.system-modules [name="modules[navigation][enable]"]> was visible after 65 milliseconds.
  ✔ Element <#system-modules-confirm-form, #system-modules-non-stable-confirm-form> was present after 52 milliseconds.
  ✔ Element <form.system-modules [name="modules[navigation][enable]"]:disabled> was present after 1868 milliseconds.
  ℹ Loaded url http://web/user/logout/confirm in 161ms

  Running Verify focus trap using inert attribute on mobile:
─────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ℹ Loaded url http://web/user/reset/1/1770837237/fFou9ORqpAdFsUFSCP93XxRjQREtOORvaNyGRAct8CA/login
 in 258ms
  ℹ Loaded url http://web/ in 186ms
  ✔ Element <body> was visible after 30 milliseconds.
  ✔ Testing if attribute 'aria-expanded' of element <.admin-toolbar-control-bar__burger> equals 'false' (37ms)
  ✔ Testing if attribute 'aria-expanded' of element <.admin-toolbar-control-bar__burger> equals 'true' (25ms)
  ✖ NightwatchAssertError
   Failed [ok]: (All elements outside toolbar should have inert attribute) - expected "true" but got: "false" (1ms)

    Error location:
    /var/www/html/core/modules/navigation/tests/src/Nightwatch/Tests/navigationMobileFocusTrapTest.js:90
    –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
     88 |           [],
     89 |           (result) => {
     90 |             browser.assert.ok(
     91 |               result.value.hasInert,
     92 |               'All elements outside toolbar should have inert attribute',
    –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––


  FAILED: 1 assertions failed and  3 passed (1.231s)

  Running Verify overlay click closes sidebar and removes focus trap:
─────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ℹ Loaded url http://web/user/logout/confirm in 108ms
  ✔ Passed [equal]: The user was logged out.
  ℹ Loaded url http://web/user/reset/1/1770837238/-s8VngInNY9kINxSgGmP3iXQGioubnFVzLYd3v-t194/login
 in 178ms
  ℹ Loaded url http://web/ in 100ms
  ✔ Element <body> was visible after 16 milliseconds.
  ✔ Testing if attribute 'aria-expanded' of element <.admin-toolbar-control-bar__burger> equals 'true' (19ms)
  ✖ NightwatchAssertError
   Failed [ok]: (Inert should be active) - expected "true" but got: "false" (0ms)

    Error location:
    /var/www/html/core/modules/navigation/tests/src/Nightwatch/Tests/navigationMobileFocusTrapTest.js:219
    –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
     217 |           [],
     218 |           (result) => {
     219 |             browser.assert.ok(result.value, 'Inert should be active');
     220 |           },
     221 |         )
    –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––


  FAILED: 1 assertions failed and  3 passed (1.215s)

  Running Verify focus trap only applies on mobile widths:
─────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ℹ Loaded url http://web/user/logout/confirm in 85ms
  ✔ Passed [equal]: The user was logged out.
  ℹ Loaded url http://web/user/reset/1/1770837239/lEzMc560DbDyLkQDUxx2_iBhU_HEYzfAgKcQvD-l5cs/login
 in 119ms
  ℹ Loaded url http://web/ in 94ms
  ✔ Element <.admin-toolbar> was visible after 19 milliseconds.
  ✔ Passed [ok]: No inert attributes should exist on desktop width
  ✔ Element <.admin-toolbar-control-bar__burger> was visible after 26 milliseconds.
  ✔ Testing if attribute 'aria-expanded' of element <.admin-toolbar-control-bar__burger> equals 'true' (21ms)
  ✖ NightwatchAssertError
   Failed [ok]: (Inert attributes should be present on mobile width when sidebar is open) - expected "true" but got: "false" (1ms)

    Error location:
    /var/www/html/core/modules/navigation/tests/src/Nightwatch/Tests/navigationMobileFocusTrapTest.js:297
    –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
     295 |           [],
     296 |           (result) => {
     297 |             browser.assert.ok(
     298 |               result.value,
     299 |               'Inert attributes should be present on mobile width when sidebar is open',
    –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––


  FAILED: 1 assertions failed and  5 passed (1.083s)

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

  ️TEST FAILURE (11.507s):
   - 3 assertions failed; 14 passed

   ✖ 1) Tests/navigationMobileFocusTrapTest

   – Verify focus trap using inert attribute on mobile (1.231s)

   → ✖ NightwatchAssertError
   Failed [ok]: (All elements outside toolbar should have inert attribute) - expected "true" but got: "false" (1ms)

    Error location:
    /var/www/html/core/modules/navigation/tests/src/Nightwatch/Tests/navigationMobileFocusTrapTest.js:90
    –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
     88 |           [],
     89 |           (result) => {
     90 |             browser.assert.ok(
     91 |               result.value.hasInert,
     92 |               'All elements outside toolbar should have inert attribute',
    –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––


   – Verify overlay click closes sidebar and removes focus trap (1.215s)

   → ✖ NightwatchAssertError
   Failed [ok]: (Inert should be active) - expected "true" but got: "false" (0ms)

    Error location:
    /var/www/html/core/modules/navigation/tests/src/Nightwatch/Tests/navigationMobileFocusTrapTest.js:219
    –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
     217 |           [],
     218 |           (result) => {
     219 |             browser.assert.ok(result.value, 'Inert should be active');
     220 |           },
     221 |         )
    –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––


   – Verify focus trap only applies on mobile widths (1.083s)

   → ✖ NightwatchAssertError
   Failed [ok]: (Inert attributes should be present on mobile width when sidebar is open) - expected "true" but got: "false" (1ms)

    Error location:
    /var/www/html/core/modules/navigation/tests/src/Nightwatch/Tests/navigationMobileFocusTrapTest.js:297
    –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
     295 |           [],
     296 |           (result) => {
     297 |             browser.assert.ok(
     298 |               result.value,
     299 |               'Inert attributes should be present on mobile width when sidebar is open',
    –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––


 Wrote HTML report file to: /var/www/html/core/reports/nightwatch/nightwatch-html-report/index.html

Failed to execute command `cd core && yarn test:nightwatch modules/navigation/tests/src/Nightwatch/Tests/navigationMobileFocusTrapTest.js`: exit status 5
➜  core git:(3443571-focus-trap) ✗
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

This is perfect! thanks @mherchel!

Manually testing I see that I do tab through the entire menu on mobile, as mentioned the sequence does go into the browser inspector, but comes back around to the mobile menu. So I can't get to any content on the page (as expected)

LGTM!

nod_’s picture

Status: Reviewed & tested by the community » Needs work

few things

mherchel’s picture

Status: Needs work » Needs review

Responded to @nod_'s comment in Gitlab

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Believe feedback from @nod_ has been addressed

nod_’s picture

Status: Reviewed & tested by the community » Needs work

not quite yet :)

mherchel’s picture

Status: Needs work » Needs review

Addressed @nod_'s latest comments. MR updated. Should be good to go :)

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Manually testing this still seems to work as advertised.

lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Committed! Thank you for everyone who worked on this 🙌

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • lauriii committed 8e66160f on 11.x
    fix: #3443571 Mobile version of Navigation should have focus trap
    
    By:...

  • lauriii committed 7b90b1e0 on main
    fix: #3443571 Mobile version of Navigation should have focus trap
    
    By:...
godotislate’s picture

Status: Fixed » Needs work

I think this has broken Drupal\Tests\demo_umami\FunctionalJavascript\AssetAggregationAcrossPagesTest on HEAD:

Asset Aggregation Across Pages (Drupal\Tests\demo_umami\FunctionalJavascript\AssetAggregationAcrossPages)
     ✔ Front and recipes pages
     ✔ Front and recipes pages authenticated
     ✘ Front and recipes pages editor
       ┐
       ├ Asserting ScriptBytes 206758 is greater or equal to 205500 and is smaller or equal to 206500
       ├ Failed asserting that 206758 ( is equal to 205500 or is greater than 205500 ) and ( is equal to 206500 or is less than 206500 ).
       │
       │ /builds/project/drupal/core/tests/Drupal/Tests/PerformanceTestTrait.php:636
       │ /builds/project/drupal/core/tests/Drupal/Tests/PerformanceTestTrait.php:685
       │ /builds/project/drupal/core/profiles/demo_umami/tests/src/FunctionalJavascript/AssetAggregationAcrossPagesTest.php:78
       ┴
     ✘ Node add pages author
       ┐
       ├ Asserting ScriptBytes 3769883 is greater or equal to 3767685 and is smaller or equal to 3768685
       ├ Failed asserting that 3769883 ( is equal to 3767685 or is greater than 3767685 ) and ( is equal to 3768685 or is less than 3768685 ).
       │
       │ /builds/project/drupal/core/tests/Drupal/Tests/PerformanceTestTrait.php:636
       │ /builds/project/drupal/core/tests/Drupal/Tests/PerformanceTestTrait.php:685
       │ /builds/project/drupal/core/profiles/demo_umami/tests/src/FunctionalJavascript/AssetAggregationAcrossPagesTest.php:106
       ┴

https://git.drupalcode.org/project/drupal/-/jobs/8558724

godotislate’s picture

catch’s picture

Status: Needs review » Fixed

Committed/pushed the test update, thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • catch committed 6aaf45ef on main
    fix: #3443571 Mobile version of Navigation should have focus trap
    
    By:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.