Problem/Motivation
The table drag handles are no longer keyboard-accessible. These are used in many places in the content-authoring and site-building UIs.
When table drag handles have focus, the up/down arrow keys should re-order the table rows. This has stopped working. It was working as of D8.0.0-beta10, and works in D7.43.
Where the table rows have a tree structure (e.g. menu UI) the left/right keys let a user change the indented (parent) relationship. The left/right keys are still working as expected.
Steps to Reproduce
Note: if testing with macOS, you'll need to make sure the tab key is configured to cycle focus through all links and controls - follow these Detailed instructions.
- Install 7.43
- Admin > Structure > Menus > Management >list links
/#overlay=admin/structure/menu/manage/management - Tab a bunch until focus is on the arrow(handle) for SubMenuItem (i.e. Dashboard)
Up Arrow
- Focus on Dashboard
- Press up arrow
- left/right arrow doesn't do anything
Down Arrow
- Focus on Dashboard
- Press down arrow
- left/right arrow doesn't do anything
Left/Right Arrow
- Focus on Dashboard
- Press down arrow a lot to get it under Taxonomy.
- left arrow does something
- right arrow does something
Proposed resolution
Restore the old keyboard behaviour:
- When a drag handle has focus, up-down arrow keys change the vertical order of the table rows.
- When drag handles are used on tree structures, the left/right keys can be used to control indentation.
Remaining tasks
Find out where the regression happened.- DONE. It was broken by commit dcf9ab4, between 8.0.0-beta11 and 8.0.0-beta12.- Fix it - restore old keyboard behaviour.
User interface changes
None as such. This is about restoring keyboard-accessible behaviour that stopped working. No changes are intended for pointing devices such as mice.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#118 | 2725259-118.patch | 25.34 KB | andrewmacpherson |
#118 | interdiff-2725259-1114-118.txt | 870 bytes | andrewmacpherson |
#116 | interdiff-98-114.txt | 22.66 KB | tedbow |
#114 | 2725259-114.patch | 25.34 KB | tedbow |
#114 | interdiff-109-114.txt | 15.05 KB | tedbow |
Comments
Comment #2
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedPrioritizing as major, because it affects a LOT of site-builder and content-editor tasks.
It's mitigated by the row weights fallback UI, but that's far more tedious to use. I expect this would be a big disappointment for keyboard users upgrading from D7 :-(
Comment #3
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedComment #4
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedWorks in 8.0.0-beta10
Comment #5
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedIt stopped working by 8.0.0-beta12
Comment #6
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedGit bisect narrows it down to commit dcf9ab4.
#2489826: tabledrag is broken
Oh, the irony ;-) That issue was about fixing the in-out nesting behaviour of tabledrag with tree nesting. The left/right arrow keyboard behaviour is indeed currently working in 8.1.1, but the up/down arrow keys are not.
Comment #7
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedComment #8
droplet CreditAttribution: droplet commentedMy bad. Totally forget about keyboards testing
Comment #9
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commented@droplet Thanks. I'll test this soon.
Comment #10
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedLooking good! I tried editing the administration menu (which has a tree) and the field UI for content types (single-level). Keyboard behaviour is fixed, and mouse-drag behaviour is still working as expected.
So far I've tested it with Firefox 46 and Chromium 49 on Linux. The patch only changes some jQuery which has good cross browser support, so let's RTBC this.
Comment #11
alexpottLooks like the new JavascriptTestBase could be used here.
Comment #13
droplet CreditAttribution: droplet commentedComment #15
techmsi CreditAttribution: techmsi as a volunteer commentedBug Still exists
Keys up/down, right/left still don't work.
Area tested
Tested on simplytest.me with & without patch
on Chrome 55
Patch doesn't make an item in the menu move with the arrow keys
On 7.43 without the patch, I cannot reproduce the key controls working.
Comment #16
techmsi CreditAttribution: techmsi as a volunteer commentedComment #17
droplet CreditAttribution: droplet commentedIt works after patching (in Chrome 58). Ensure you've clean the caches.
Comment #18
xjmThanks @techmsi for the thorough issue update and testing steps! Adding issue credit.
Comment #19
xjmComment #20
xjm@techmsi, there was another contributor you looked at this issue during the sprint; do you know their username?
Comment #21
droplet CreditAttribution: droplet commentedI tested it on my Mac Chrome 55. Still working. If anyone could capture a GIF or VIDEO that will help.
Note: It won't drag on the single parent. For example in D8 Admin menu, you can't drop default "Administration".
Needed more debug info. Thanks ALL.
Comment #22
droplet CreditAttribution: droplet commentedComment #23
xjm@catch, @cilefen, @alexpott, @Cottser, @lauriii and I discussed this issue and agreed that it is major priority due to the impact of the accessibility regression. Thanks @techmsi for helping get this triaged!
Comment #24
GrandmaGlassesRopeManReviewing.
Comment #25
GrandmaGlassesRopeManAlright. Tested this in Chrome 58 on macOS. This probably still needs JS tests.
Prior to the patch the keyboard interaction behavior is a strange, as expected.
With the patch applied, the keyboard interaction behavior is what I would expect.
Comment #26
mgiffordVery nice visualization @drpal how did you make it?
We should include it more often.
Comment #27
droplet CreditAttribution: droplet commented@mgifford,
I'm not sure what @drpal used. But on MacOS, you can do it as simple as:
http://osxdaily.com/2013/06/21/mac-virtual-keyboard-os-x/
Windows:
https://support.microsoft.com/en-us/help/10762/windows-use-on-screen-key...
(Windows, only click with mouse has hover effect)
Comment #28
droplet CreditAttribution: droplet commentedMissing a test :)
Comment #29
mgiffordThanks @droplet - no idea how I missed that.. Very useful!
Comment #30
effulgentsia CreditAttribution: effulgentsia at Acquia commented#8 no longer applies. This is a straight reroll. It's not correct, since it doesn't include the change to the
tabledrag.es6.js
file, so if someone can reroll to include that, that would be awesome. Just posting this in the meantime for anyone wanting to do additional manual testing.Comment #31
GrandmaGlassesRopeMan- rerolled from #30 to include the changes in the
*.es6.js
file.Comment #32
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedGlad to see some more progress on this.
#25 - @droplet, I love the animated GIF evidence with on-screen keyboards!!!! Would love to see more of that in a11y issues, it's a great way to demonstrate bugs and fixes.
Comment #34
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedBug, so eligible for 8.4.x
Comment #35
dawehnerWhile doing some manual testing I saw that up, down and right works as expected. Left has a little bit of a problem IMHO, it just goes up one level max.
I went to
/admin/structure/menu/manage/admin
and focused content. I was able to move it intoadmin/structure/content-types
, but once I tried to move it out again the maximum level back as/admin/structure
. Is this another level of the same bug basically, or should this be handled in its own issue?Comment #36
GrandmaGlassesRopeMan@dawehner Can you record that behavior? It might be a new bug.
Comment #37
droplet CreditAttribution: droplet commented@dawehner,
Can you use Mouse to do the same thing? and compare the behavior with D7 also.
Comment #38
GrandmaGlassesRopeManComment #39
fisherman90I'm trying to reproduce record the behavior described by @dawehner
Comment #40
geophysicist CreditAttribution: geophysicist as a volunteer commentedComment #41
kwoxer CreditAttribution: kwoxer commentedI'm reviewing this from the DrupalCon.
Comment #42
fisherman90Here's my recording of the behavior after the patch 31 on 8.4.
@dawehner (#35) I think this isn't a bug maybe. Because if your element is in the second or third level and the left button is used - if it should go one level up then - it could result in a jump of the screen in long lists, which could confuse the user. Also we then have to assume if the element should go over or under it's previous parent element. The way it's now, the user has the control over it by moving the element up - before the parent element - or down - past the parent element and it's children.
Also, if the selected element is the last one in the parent's children, the left button works as expected, because then we can assume it should be sorted after the parent element.
For me it's in a usable state. What are your thoughts about it?
Comment #43
kwoxer CreditAttribution: kwoxer commentedPatch 31 works properly as @fisherman90 said and has a good usability.
Issues
There are still 2 issues, I would really appreciate being fixed in terms of usability.
Issue#1: Showing lines
There is just one more thing that would be amazing when also be done. So currently there are no lines showing the corresponding elements. As this really helps when moving elements, it would be great to always show them:
So currently thelines are just shown when arrow keys are used once:
For me that does not make sense:
Possible solutions:
Issue#2: Visual feedback (exclamation mark) when move was forbidden
The other issue for keyboard using would be to give visual feedback when something went wront like going left was not possible like you see in that picture. Instead of just doing nothing there needs to be at least something to be happening like showing an information.
Comment #44
kwoxer CreditAttribution: kwoxer commentedComment #45
geophysicist CreditAttribution: geophysicist as a volunteer commented@kwoxer
You want to apply * for all child elements of cahnged menu item?
Comment #46
kwoxer CreditAttribution: kwoxer commentedComment #47
kwoxer CreditAttribution: kwoxer commentedHi @geophysicist no you get me wrong. I updated the pictures. So it's not about the asterisks. It's just about the lines. :)
Comment #48
geophysicist CreditAttribution: geophysicist as a volunteer commentedI will try to apply some notifications when it's not possible to move items left.
Comment #49
fisherman90We should put the visual feedback into a seperate issue, so that patch can go to RTBC once the accessibility group was looking over it. @geophysicist ok?
Comment #50
kwoxer CreditAttribution: kwoxer commentedCreated Issue for the showing the lines in the table before dragging.
Comment #51
kwoxer CreditAttribution: kwoxer commentedCreated as well Issue for showing a hint when a keyboard arrow move was not possible
Comment #52
lmendes-omibee CreditAttribution: lmendes-omibee as a volunteer commentedPatch is tested and working in Drupal 8.4 - MacOS Chrome. Safari and Firefox on MacOS won't focus the arrows unless the accessibility settings in the browser are updated. Example: https://stackoverflow.com/a/11713537
Comment #54
joshmillerassumed unassigned after months of inactivity.
Also, needs accessibility work according to above feedback.
Comment #55
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commented@joshmiller - fixing accessibility is the entire point of this issue :-) Keyboard control of the tabledrag handle is broken in all browsers, and was previously working in D7 and D8 beta.
The macOS setting in #52 is useful to know about if you're doing manual testing of patches here. I added it in the issue summary.
But the macOS setting isn't part of the bug here. Background story:
This has been the behaviour of mac Safari for at least 7 years. Safari gained a behaviour where users could choose between making links and form controls tab-able, or just form controls. Apple marketed it as "advanced form control" or something. Later the setting was moved to the system preferences, and eventually other browsers on OS X started respecting this system preference too.
It's not up to us to try and work around such OS-level user preferences. Mac users who rely on keyboard-only control will need to have this user preference enabled in order to navigate any website at all, not just Drupal's tabledrag handles. We just have assume the OS-level preference is set to tab though links.
On Windows and Linux browsers, this user preference doesn't exist. The tab key takes you though all links and form controls. Macs used to behave this way too once. Why Apple introduced the setting is something I've never quite understood. I think it has to do with making things easier for people who generally use a mouse pointer, but like to use the tab key when completing forms. Data entry by people who don't have motor disabilities.
Anyway, the macOS setting is a red herring as far as this bug is concerned.
Comment #56
mgiffordWonder if it might make sense to think about a solution that works with #2920006: Research accessibility of drag-and-drop grid interfaces. too.
Comment #57
claudiu.cristea#2769825: Cannot swap tabledrag rows by dragging the lower over the upper row in tests might be related.
Comment #58
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedRe-rolling against 8.5.x. Setting needs review just for the bot, the patch still misses tests.
Comment #59
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedBack to needs work for the tests.
Comment #60
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedWrote tests to cover keyboard accessibility.
As @claudiu pointed out in the related issue #2769825: Cannot swap tabledrag rows by dragging the lower over the upper row in tests there are issue dragging items from a lower row to an upper one, so I also added the root - leaf test to cover that part too. It's missing test coverage regarding grouped items though, as that adds a bit extra complexity due to the grouping itself and I ran out of time for now.
Note: I took the test module code from #2769825: Cannot swap tabledrag rows by dragging the lower over the upper row in tests written by @claudiu and adapted it.
Comment #61
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedAdding the full patch and the interdiff with #58 just to show that there were no additional changes.
Comment #64
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedLooking into the failures.
Comment #65
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedComment #66
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedAdding a drupalci.yml to try to debug the failures. Also replaced assertions.
Comment #67
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedComment #69
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedComment #70
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedComment #72
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedThis is really strange. Trying to get the browser output again.
Comment #74
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedStill trying to get the proper drupalci.yml in.
Comment #76
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedOps, the latest patch accidentally included a wrong selector. In the meantime I managed to reproduce the issue locally. The CI runs chromedriver with
--headless
. If I do the same, the test fails. I'll look into it.Comment #78
claudiu.cristeaThis is a patch against #61.
Comment #79
claudiu.cristeaComment #80
claudiu.cristeaAdding the changes from #66 and #69.
Comment #81
claudiu.cristeaThe 8.6.x version of #80.
Comment #82
claudiu.cristeaReady for RTBC.
Comment #83
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedThanks for moving forward with writing the tests!
I did manual testing with latest Firefox and Chrome on Linux, and I'm happy with it the behaviour. I tested both nested tables (the administration menu) and flat tables (display fields for article), with keyboard and mouse.
Something I want to check: has manual cross-browser testing been done? I haven't tried with IE, Edge, or Safari. Or touch screens.
I don't understand the draggable table test module - it doesn't have any rows! Here's a screenshot of what I see:
It seems that that
TableDragTestForm::buildForm()
only outputs rows if some state is set, and this gets done programatically by the methods in the functional JS test class.I think this test module should be set up so we can do manual testing with it too - test modules aren't just for the testbots (we did a lot of manual testing on various test modules while getting inline form errors ready, for instance).
If the FunctionalJS tests need particular states, that's fine, but it would be good if there was an output format for when no state was available. Or maybe we could have a couple of test tables (one nested, one flat), and put these in primary tabs on the test page?
Comment #84
claudiu.cristeaI disagree that testing modules *should* necessary work by their own. However, I added a default set of 5 rows to the table. Tests are overriding with their rows.
Comment #85
claudiu.cristeaReroll and moved the bug in 8.6.x.
Comment #86
claudiu.cristeaComment #87
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedReview of patch#85:
I did another round of manual testing, and covered all our supported desktop browsers on Windows 10 and macOS High Sierra. I also tested it with Android 8 + Chrome on a phone, with a USB keyboard. All good. I haven't tested it on iOS because I didn't have a Bluetooth keyboard handy.
Thanks for updating the test module. The default rows in the test module really helped me understand what was going on in the tests (by following them manually). We still don't have many keyboard accessibility tests, so this was really useful.
I think the tests in #85 cover all the possible movements, except for the scenario where you move a row which has nested children. So I've added one of those movements, after the sequence we already have.
Nit: we're expecting level 2. I changed this comment in this patch.
It's good to see that Mink NodeElement::keyPress() works as expected with the WebDriverTestBase. The PhantomJS driver is buggy with key events.
Comment #88
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedComment #90
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedLast comment has a passing patch, and a failing tests-only patch, to confuse the bots.
Comment #91
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commented@andrewmacpherson good to add at least one test for the nested children. I took it initially out that part because the nesting functionality has many scenarios to cover.
I am actually not happy about the code I wrote in
assertTableRow()
line 281-283. When the tests are asserting that nothing is changed, those lines will wait pointlessly. We should try to remove them.Comment #92
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commented@sardara: These ones? I noticed them when I was testing #85.
I couldn't understand why we needed to wait up to 10s here. There's already a wait of 500ms at the end of
moveRowWithKeyboard()
, so there's time for the DOM updates to complete before we even callassertDraggableTable()
.This patch removes them. The tests still run fine on my machine, let's see how they do with the testbots here.
Comment #94
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedComment #95
claudiu.cristeaPerfect. I only did a reroll so I guess I can RTBC.
Comment #96
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commented@andrewmacpherson yes those lines. They were added when trying to solve the failures on the tests, which were solved by @claudiu.cristea with the change of mink driver. So yes, they are useless.
Thanks for updating the patch!
Comment #97
GrandmaGlassesRopeManLooks like you forgot to run
prettier
.Comment #98
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedUpdated the es6 file with prettier. That's a new thing in my workflow.
I see that running
yarn build:js
afterwards doesn't result in any changes to thetabledrag.js
file. Is that expected - prettier's just about the readability of the es6 source file?Comment #99
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedComment #100
claudiu.cristea@andrewmacpherson Thank you
Comment #101
claudiu.cristeaOne more thing after re-reading the patch. We should test also if the "You have unsaved changes." message is show on the page after a row drag.
Also...
This not a correct way to wait. We have to wait until some JS condition is met, not an amount of time.
Comment #102
volkswagenchickTagging for badcamp, thanks
Comment #103
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedTackling last remark from @claudiu.cristea.
Added a js library that adds an event to the row handle. Due to the order of inclusion of the js libraries, this event will be executed after the ones added by the tabledrag library.
In the php test a css class is added before moving a row, and then the test will wait until said class is removed by the script.
The tabledrag library allows to add custom handlers to be specified on some events, but we need one that gets executed even when no swapping/dragging happens. This is useful for tests when no changes should happen.
The test js library added only takes care of the "keydown" event, meaning that for now it works only when rows are moved through the keyboard, as this is what the test does. Further support can be added when needed.
Comment #104
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedMissed the remark about the changed warning. Attaching a patch with an extra test.
Comment #105
tedbow@sardara while this is clever way for test to wait for the changes I think if we can avoid our test depending on extra Javascript on the page we should
I have changed
assertDraggableTable()
keep checking the structure of the table for 2 second until correct. This is similar to\Behat\Mink\Element\Element::waitFor()
which is used by\Drupal\FunctionalJavascriptTests\JSWebAssert::waitForElement()
and similar methods.Since the checks happen every .1 seconds most runs will only wait .1 seconds but the tests are running slow as we see random failures in DrupalCI the test will still pass.
I think will still need to wait for this text to appear to avoid random test failures on DrupalCI
Comment #106
tedbowThis can't return a null if we assert it is not. Also because we passing it to
moveRowWithKeyboard()
so it will always be NodeElementI am not sure why we are throwing exceptions vs just asserting that $row is not empty.
I think it would simpler just throw an exception if
$keys[$arrow]
is not set.I am not sure why we are throwing exceptions vs just asserting that $row is not empty.
Comment #107
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedReplying to #105 remarks:
1. Using an arbitrary amount of time is exactly what was asked by @claudiu.cristea to be avoided in #101. This is especially true because we have some parts of the test that verify that some rows cannot be moved. By depending on a real condition (the class being removed by JS) we are sure that the row wasn't moved.
2. Yes it should wait indeed as it happens on blur of the handle, which is after moving the row.
Isn't this subject to random failures on the CI anyway? It could take more than 1 second to show.
This won't do. We have assertions where we check that rows are not moved under some conditions. This code still doesn't ensure that the table operations are over and it will return true over the first check. In those cases we would be relying on 2 seconds being enough time for JS to finish.
Replying to #106 remarks:
1. Yes indeed the function doc makes no sense, good catch.
2. Why use an assertEmpty() instead of throwing a proper exception of a specific type? I think using ElementNotFoundException is more correct and it's usually thrown in these scenarios. If we want to improve that, we should use
\Behat\Mink\WebAssert::elementExists()
which returns also the node given the xpath.3. Agree.
4. I think this is duplicate of the first point.
Comment #108
tedbowI do see why my way won't work yet for this case.
The problem I mainly see with #104 is that our test covering Javascript code now depends on Javascript code that itself is not tested. If we can find a way to avoid that we should but maybe we can't.
Reviewing #104 locally again it is actually failing randomly for me on
\Drupal\FunctionalJavascriptTests\TableDrag\TableDragTest::assertTableRow()
But not on the same line.
For now here is a version of 104 that will run only this test 50 times. To see if these random fails happen on DrupalCI.
Comment #109
tedbowI am not sure what was happening locally for me. #108 seems to show no random test errors.
my comment
So maybe we can't
Switching back to @sardara's patch at #104 with just a couple of changes.
from my review on #106
1. fixed
2. If you search for "throw new ElementNotFoundException(" in core you there is only 1 instance outside of
\Drupal\FunctionalJavascriptTests\JSWebAssert
or\Drupal\Tests\WebAssert
. If you search for$this->assertNotEmpty(
you will find many instances where it is being used to check if expected element is not empty.I think we should change just to make this more readable alongside other core tests.
fixed
3. fixed
Comment #110
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commented@tedbow which errors are you getting? I only had issues if I touch the browser window while tests are running (as focus gets shifted around).
Regarding your comment
This test itself tests the extra JavaScript, because if the class added in the php code is not removed by the JS code the test will fail. So I think we are safe.
Regarding point 2 of #109, it's ok for me too to change it.
By the way, did the test run really 50 times? I see only 3.
Comment #111
tedbowThis may have been the problem. I only noticed when the test browser was in the background.
Run only this test 50x
Yeah the report page I don't think counts duplicate runs. this test class has 3 test methods so that is where it comes from. You have to click through to
View results on dispatcher -> Console Output
That will get you here: https://dispatcher.drupalci.org/job/drupal_patches/79372/console
where you can see the test running and passing 50x.
Comment #112
GrandmaGlassesRopeMan- JavaScript is 👍, these changes are minor and the test coverage appears to be robust.
- @andrewmacpherson, it looks like you've provided a number of reviews on the accessibility side of this patch.
- The two additional feature requests from #43 are part of a series of followups, #2912732: Table Drag always showing lines and #2912737: Table Drag showing visual feedback when move was forbidden
Comment #113
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedOh yeah makes sense, thanks for the explanation!
Comment #114
tedbowSorry to change a test that is already passing but here are couple test changes that I think make the test more readable and more certain it is not passing just because the structure of the test.
Only 1 row in the table has changed here.
But for anyone to really review this test assertion you have to actually confirm not only that row index 1 has changed you also have to confirm that all other rows have not changed.
We could make this test more understandable by assigning the table structure to
$expected_table
at the beginning of the method and before every assert updating only the rows in$expected_table
that actually should have been changed. This will help make sure the test is not working because of copy/paste error in any case.Changed in subsequent calls.
Here we are asserting the table structure has not changed. But to review the test and make sure it is not passing because of problem in the test itself you actually have to make sure array passed to
assertDraggableTable()
is exactly the same as the previous call.Again we can fix this by using a variable
$expected_table
that we know hasn't changed(because it is not passed by reference).Comment #115
sardara CreditAttribution: sardara at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedI'm fine with the change even if I fail to see the issue as we are reviewing the patch so it's not hard to verify that the lines are correct.
Anyway let's go this way, but I would like to focus on getting this patch committed as the bug is quite severe, breaking accessibility to tables.
Comment #116
tedbowJust adding an interdiff from 109 which is the last it was RTBC. It was just pushed back for test change not for the actual JS fix.
a lot of the diff is the test module that @sardara put in in #103 so that we can confirm that something did NOT move if it should not have. I pushed back on this but I am not convinced we need it as per #109
Comment #117
bnjmnmTwo nits and I can RTBC it
Change "behaviours" to "behaviors" to match Drupal's naming
Typo with "operatios"
Comment #118
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedFixes #117.
Also wraps the docblock in comment in 117.2 to fit under 80 chars.
Comment #119
bnjmnmComment #121
tedbowSetting back to RTBC because random unrelated fail in MediaStandardProfileTest. I checked and there doesn't to be anything related to a table drag there.
If test fails again it will automatically get kicked back.
Comment #122
alexpott@lauriii asked me to look at this issue from a backport perspective.
(‘tr:first-of-type’)
to(‘tr’).eq(0)
- this is a minimal change and is not API:first-of-type
pseudo selector in core.Therefore for +1 to commit and +1 to backporting to 8.6.x
Comment #123
alexpottI ran the new test against 8.6.x locally and it passes.
Comment #126
lauriiiI think we should be safe backporting this since this only affects keyboard navigation code which prior to this change is completely broken. This is due to the fact that the selectors used before are simply broken. Using
:first-of-type
in.next()
doesn't make sense since it has been designed to match the first of type inside their parent. This selector will simply never match because.next()
can only match elements that are not the first element inside the parent element.Thank you also for adding extensive test coverage for tabledrag. This will significantly improve the maintainability of this component.
Committed 735aaca and pushed to 8.7.x, as well as cherry-picked to 8.6.x. Thanks!
Comment #130
lauriiiFixed commit credit
Comment #135
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedAwesome! It's a huge relief to see this one fixed at last - it will have a very broad impact for accessibility and usability. Thanks to everyone who worked on this.
This fixes tabledrag for sighted keyboard users, but there are improvements we can make to help screen reader and speech control users, who still need to use the show-weights alternative. I opened #3027229: Modernize tabledrag accessibility. to follow this.
A significant outcome of this issue, is we now have a lot more insight into writing functional tests for keyboard operations, distinct from mouse operations. Prior to using WebDriver this was awkward anyway (Goutte keyboard driving was flaky). Between this issue and #2711907: [regression] Some ajax-enabled buttons are not keyboard operable, we now have enough experience to start expanding functional JS coverage for keyboard accessibility, using WebDriverTestBase or Nightwatch.
Committers: can you start asking for keyboard behaviour tests, wherever the patch involves a keyboard event in JS? You can tag issues with needs accessiblity review to get advice on expected behaviours. Meanwhile, I'll start a list of existing keyboard behaviour that we can write test cases for.
Comment #136
lauriii@andrewmacpherson I think requiring tests for keyboard behavior is a good idea. We should open a new issue to add it to the Drupal core gates.
Comment #137
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commented@lauriii Done.