Problem/Motivation
When edit mode is enabled via the toolbar "Edit" button the contextual button become visible and the tabbing is constrained to the contextual buttons.
When you load a page with edit mode already enable the contextual buttons are visible on reload but the tabbing is no longer restricted.
Edit mode is suppose to persist when the page is reloaded see
Drupal.contextualToolbar.VisualView.persist()
This a problem for instance when you click "Configure Block". This will take you the Edit block form. If you either save the block form or click the "Back to Site" link when return the original page Edit mode will be in effect but the tabbing will not be constrained.
Proposed resolution
Ensure tabbing is constrained is edit mode is enabled on page reload.
Remaining tasks
create tests for tabbing.
create patch fixing
User interface changes
Tabbing will be restricted on page reloaded
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#11 | 2919147-11.patch | 4.63 KB | tedbow |
#11 | interdiff-8-11.txt | 1.38 KB | tedbow |
#8 | 2919147-8.patch | 4.62 KB | tedbow |
#8 | interdiff-5-8.txt | 2.65 KB | tedbow |
#8 | 2919147-8-TEST_ONLY.patch | 3.56 KB | tedbow |
Comments
Comment #2
tedbowOk lets start by updating the existing test
\Drupal\Tests\contextual\FunctionalJavascript\EditModeTest::testAnnounceEditMode
to reload the page twice to confirm that the tabbing constraint is announced with the second page load when edit mode will already be enabled.
I think this is the correct behavior. If I look at the toolbar tray items if they are already open when the page is loaded this does get announced. So this would make edit mode act the same way.
The test-only patch should fail.
The fix in the other patch does work to announce and constrain the tabbing but I have just noticed that on page reload the message is
So we will have to call
Drupal.contextualToolbar.AuralView.manageTabbing
at a later point after the contextual links are load on the page(even though the tabbing is actually constrained to the correct links).Comment #4
mgiffordremoving "a11y" tag since we aren't using it.
Comment #5
tedbowOk I tried to figure how to test the tabbing restriction by pressing tab and count how many elements were tabbed to because you can't get the currently focused element from
$this->getSession()->getPage()
.I tried a bunch of things such as
executeScript()
find the currently active element marking it with an attribute and then retrieving it from$page
. Nothing worked well.So instead I created
\Drupal\Tests\contextual\FunctionalJavascript\EditModeTest::getTabbableElementsCount
. Which with a couple calls to\Behat\Mink\Session::executeScript
can find the count.So this test now asserts that the tabbing is restricted in edit mode.
Comment #7
tedbowUpdated summary to include "Configure Block" example.
Comment #8
tedbowCleaned up the test changes. Variable names and comments.
Comment #10
tim.plunkettPlease! rename this variable.
Also starting at 0 and going to < 2 is clearer IMO
Can use assertGreaterThan()
Otherwise, looks good!
Comment #11
tedbow@tim.plunkett thanks for the review!
fixed issues in #10
Comment #12
tim.plunkettLooks good, thanks!
Comment #14
GrandmaGlassesRopeMan🤷♀️
Comment #15
webchickCommitted and pushed to 8.5.x. Thanks!