Problem/Motivation
See #2729663: Fragment link pointing to <textarea> should be redirected to CKEditor instance when CKEditor replaced that textarea. Same problem with CKEditor 5.
Steps to reproduce
Trigger a validation error on a text field using CKEditor 5 while Inline Form Errors is enabled.
Proposed resolution
Implement a solution similar to #2729663: Fragment link pointing to <textarea> should be redirected to CKEditor instance when CKEditor replaced that textarea.
When suggested to implement this upstream, the CKEditor developers reacted surprised: they've never seen this requested before. Since it's simple enough to implement and maintain on our side, the above seems fine.
Remaining tasks
Port test coverage from.\Drupal\Tests\ckeditor\FunctionalJavascript\CKEditorIntegrationTest::testFragmentLink()
Port test coverage from\Drupal\Tests\inline_form_errors\FunctionalJavascript\FormErrorHandlerCKEditorTest()
.Add fix.
User interface changes
Fragment link navigation pointing to text fields using CKEditor 5 now works.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#18 | 3238257-18-D9.patch | 10.55 KB | Wim Leers |
#18 | 3238257-18-D10.patch | 10.42 KB | Wim Leers |
|
Issue fork drupal-3238257
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:
- 3238257-fragment-link-pointing changes, plain diff MR !1631
Comments
Comment #2
Wim LeersComment #6
hooroomooTest is currently expected to fail because it is using the wrong $ckeditor_id but not sure why it is failing on the "assertNotVisibleInViewport" assertion on line 104.
Comment #7
hooroomooWorks when manually tested but still unsure why line 107 which has the "assertNotVisibleInViewport" assertion in the CKEditor5FragmentLinkTest.php file keeps failing.
Could also use a review before I add another test for this in inline-error form.
Comment #8
ranjith_kumar_k_u CreditAttribution: ranjith_kumar_k_u at Zyxware Technologies commentedFixed CS errors.
Comment #10
Wim Leers@ranjith_kumar_k_u Can you please commit your change to the merge request instead? By uploading a patch, you introduced a parallel path 😅
Comment #11
Wim LeersThis is definitely on the right track 😊
Let's first try to get tests to pass — I posted a suggestion that I think will fix this.
Then let's try to tackle that "unique URL on every redirect" problem.
Comment #12
hooroomooComment #13
tim.plunkettFixing credit
Comment #14
Wim LeersAlmost there!
Issue summary updated. After my feedback is addressed, this will be RTBC :) Also bumping this to #2729663: Fragment link pointing to <textarea> should be redirected to CKEditor instance when CKEditor replaced that textarea.
because without this, CKEditor 5 will regress compared to CKEditor 4 when using Inline Form Errors for improved accessibility. Plus, the equivalent CKEditor 4 issue was too:Comment #15
hooroomooComment #16
Wim LeersManually tested one last time; works great!
All my concerns have been addressed.
Thanks, @hooroomoo!
Comment #17
lauriiiThis needs a Drupal 10 patch 😇
Comment #18
Wim LeersUploading both D9 and D10 patches extracted directly from the latest MR (the only difference being that I ran
cd core && yarn install && yarn build:js
again for the D10 patch), which makes it easy to compare what's different between the two. Basically:var
vsconst
, due to #3253148: Remove IE from core's browserlist, remove non-essential CSS importing and recompile assets.P.S.: due to #3253148: Remove IE from core's browserlist, remove non-essential CSS importing and recompile assets we're going to have to create D10 patches for any JS change that affects Drupal-owned JS for the CKEditor 5 module 😬
Comment #22
lauriiiCommitted 241794b and pushed to 10.0.x. Committed the Drupal 9 patch to 9.4.x and cherry-picked to 9.3.x because CKEditor 5 is still experimental. Thanks!