Trying to address the fragment issue of points 4 and 6 from #1440628: [Meta] javascript toolbar/tableheader with url fragment mess.

4) tableheader + fragment: the browser will scroll so that the element with the targeted id shows up at the top of the screen. If you have elements set with position:fixed the fragment targets is hidden behind. #567754: Wrong anchor adjustment in tableheader.js
6) toolbar + fragment: this patch is supposed to fix it #546126: Toolbar interferes with anchor links but it does not work.

Patch needs work, properly define/inlude js libraries, clean up some code, testing but basis should be there.

Steps to reproduce

  1. Go to add new node form. Do not enter any information.
  2. Scroll down to the save button and ensure that the title field is above your viewport
  3. Click save, the title will be overlayed by the admin toolbar.

Before in Firefox:

before Firefox
After in Firefox:

after Firefox

Before in Chrome:
before Chrome
After in Chrome:

after Chrome

CommentFileSizeAuthor
#71 Screenshot 2021-03-08 at 12.11.32.png48.6 KBGauravvvv
#71 Screenshot 2021-03-08 at 12.07.26.png44.36 KBGauravvvv
#68 Firefox_After_apply_patch.jpg362.37 KBvikashsoni
#68 Firefox_before_apply_patch.jpg371.79 KBvikashsoni
#68 Chorme_After_apply_patch.jpg280.3 KBvikashsoni
#68 Chrome_before_apply_patch.jpg293.04 KBvikashsoni
#65 core-js-offset-1870006-65.patch2.76 KBnod_
#64 1870006-html5-validation-scroll-64-8.9.x.patch5.99 KBpiyuesh23
#61 After-patch-firefox.jpg362.37 KBranjith_kumar_k_u
#61 Before-patch-firefox.jpg371.79 KBranjith_kumar_k_u
#61 After-patch-chorme.jpg280.3 KBranjith_kumar_k_u
#61 Before-patch-chrome.jpg293.04 KBranjith_kumar_k_u
#59 1870006-html5-validation-scroll-59.patch5.84 KBRenrhaf
#45 firefox-before-patch.jpg69.87 KBjay11377
#45 chrome-before-patch.jpg67.99 KBjay11377
#43 1870006-43.patch4.13 KBGrandmaGlassesRopeMan
#43 interdiff-1870006-37-43.txt3.01 KBGrandmaGlassesRopeMan
#39 1870006-patch37-testing_html5forms_chrome59.png102.68 KBandrewmacpherson
#39 1870006-patch-37-testing_html5forms_firefox54.png94.63 KBandrewmacpherson
#37 interdiff-1870006-36-37.txt294 bytesBarisW
#37 core-js-offset-mess-1870006-37.patch4.14 KBBarisW
#36 interdiff-1870006-31-36.txt1.5 KBBarisW
#36 core-js-offset-mess-1870006-36.patch3.95 KBBarisW
#33 interdiff-1870006-26-31.txt6.32 KBandrewmacpherson
#33 interdiff-1870006-10-26.txt4.63 KBandrewmacpherson
#33 fruits-toc-links-long-article.html_.txt27.54 KBandrewmacpherson
#31 core-js-offset-mess-1870006-31.patch3.33 KBBarisW
#26 core-js-offset-mess-1870006-26.patch4.49 KBpk188
#10 core-js-offset-mess-1870006-10.patch2.77 KBnod_
#6 core-js-offset-mess-1870006-6.patch2.82 KBnod_
#4 core-js-offset-mess-1870006-4.patch7.52 KBnod_
core-js-offset-mess.patch7.51 KBnod_
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nod_’s picture

Status: Active » Needs review

NR to get some opinions.

Status: Needs review » Needs work

The last submitted patch, core-js-offset-mess.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review

Random faillure

nod_’s picture

nod_’s picture

Status: Needs review » Needs work

lots changed.

nod_’s picture

Status: Needs work » Needs review
FileSize
2.82 KB

Made a mess of everything, but it's upated to use the new Drupal.displace things and kind of works for fragments and html5 form errors. The sticky headers for tables are not taken into consideration but meh.

Putting NR for attention

casey’s picture

Priority: Normal » Major

#800270: Anchor/focus hidden beneath toolbar/tableheader (CKEditor full screen menu) also handled keyboard navigation (TAB). Unfortunately no time to review.

mgifford’s picture

Status: Needs review » Needs work
Issue tags: +JavaScript clean-up, +Needs JavaScript testing

The last submitted patch, core-js-offset-mess-1870006-6.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
FileSize
2.77 KB
Wim Leers’s picture

Status: Needs review » Needs work
  1. +++ b/core/misc/offset/fragment.js
    @@ -0,0 +1,26 @@
    + * Offsets the window to allow fragments navigation with fixed positioning elements.
    

    80 col.

  2. +++ b/core/misc/offset/fragment.js
    @@ -0,0 +1,26 @@
    +  "use strict";
    ...
    +  function adjustOffset () {
    

    Why this indentation? We don't do that elsewhere either.

    Also in other JS file.

  3. +++ b/core/misc/offset/fragment.js
    @@ -0,0 +1,26 @@
    +  // Checks for a fragment on page load, outside Drupal behaviors.
    +  Drupal.behaviors.adjustOffset = { attach: adjustOffset };
    

    "outside" behaviors, yet you make it into a behavior?

  4. +++ b/core/misc/offset/html5forms.js
    @@ -0,0 +1,13 @@
    + * Focus the HTML5 validation error in view.
    

    Cool :) But where can I see this in action?

  5. +++ b/core/modules/system/system.module
    @@ -952,6 +952,10 @@ function system_library_info() {
           'core/misc/drupal.js' => array('group' => JS_LIBRARY, 'weight' => -18),
    +      'core/misc/debounce.js' => array('group' => JS_LIBRARY),
    +      'core/misc/displace.js' => array('group' => JS_LIBRARY),
    +      'core/misc/offset/fragment.js' => array('group' => JS_LIBRARY),
    +      'core/misc/offset/html5forms.js' => array('group' => JS_LIBRARY),
    

    Why? Because they can be considered fundamental?

    Shouldn't the html5forms thing be included with the drupal.form library, and drupal.displace only be loaded when the Toolbar is active, i.e. a dependency of Toolbar's library?

nod_’s picture

That's too cosmetic for the state the patch is in :þ

To test the HTML5 validation, just create a node, don't put a title, scroll down and try to save and publish.

jessebeach’s picture

+++ b/core/modules/system/system.module
@@ -952,6 +952,10 @@ function system_library_info() {
       'core/misc/drupal.js' => array('group' => JS_LIBRARY, 'weight' => -18),
+      'core/misc/debounce.js' => array('group' => JS_LIBRARY),
+      'core/misc/displace.js' => array('group' => JS_LIBRARY),
+      'core/misc/offset/fragment.js' => array('group' => JS_LIBRARY),
+      'core/misc/offset/html5forms.js' => array('group' => JS_LIBRARY),

I agree, I'm having trouble parsing this. So it makes no sense for drupal.js to depend on the displace.js library, since displace.js itself relies on drupal.js. But since the displace library depends on the drupal library, we end up in something of a loop.

The only resolution I can come up with is explicitly declaring dependencies on the debounce, displace, and fragment libraries and letting them all depend on the drupal library, since it declares the Drupal object.

nod_’s picture

I put that in to not think about all this.

It's really the architecture of the JS code that needs work here before we get into anything else.

klonos’s picture

mgifford’s picture

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mgifford’s picture

Issue tags: +Accessibility

I'm tagging this for accessibility as it's required to get inline form errors as a fully fledged part of Core.

dmsmidt’s picture

dmsmidt’s picture

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

wolffereast’s picture

Issue tags: +Baltimore2017

Beginning triage.

wolffereast’s picture

Version: 8.3.x-dev » 8.4.x-dev
Issue summary: View changes
Issue tags: -Needs issue summary update +Needs reroll, +Triaged for D8 major current state

Verified that the issue still exists.
Updated issue summary.

cilefen’s picture

I am adding credit to wolffereast for the triage work done.

pk188’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
4.49 KB

Re rolled.
Not find all the issues.

pk188’s picture

.

GrandmaGlassesRopeMan’s picture

Status: Needs review » Needs work
  1. diff --git a/core-js-offset-mess-1870006-10.patch b/core-js-offset-mess-1870006-10.patch
    

    Don't include the patch.

  2. +++ b/core-js-offset-mess-1870006-10.patch
    @@ -0,0 +1,84 @@
    +diff --git a/core/misc/offset/fragment.js b/core/misc/offset/fragment.js
    

    Missing ES6 file.

  3. +++ b/core-js-offset-mess-1870006-10.patch
    @@ -0,0 +1,84 @@
    +diff --git a/core/misc/offset/html5forms.js b/core/misc/offset/html5forms.js
    

    Missing ES6 file.

@pk188

We have changed the process for how JavaScript is built in D8. Have a look at [#2815083] to get a better understanding of what needs to happen.

dmsmidt’s picture

Issue tags: +sprint
BarisW’s picture

Assigned: Unassigned » BarisW

Working on this now at the Haarlem sprint.

BarisW’s picture

Assigned: BarisW » Unassigned
Status: Needs work » Needs review
FileSize
3.33 KB

I applied the comments in #28. The patch in #26 was missing the JS includes from patch #10. I added the new JS files in the drupal.form library and added an extra dependency on drupal.displace.

andrewmacpherson’s picture

Assigned: Unassigned » andrewmacpherson

assigning to myself for review at the Amsterdam a11y sprint

andrewmacpherson’s picture

Assigned: andrewmacpherson » Unassigned
Status: Needs review » Needs work
FileSize
27.54 KB
4.63 KB
6.32 KB

Reviewing the patch #31:

  1. misc/offset/fragment.js is bundled with drupal.form. I think it should really be a dependency of the toolbar and table-header libraries, because these are the things we are trying to avoid overlapping with. Fragment IDs are found in content too. I've attached a bit of specimen HTML to simulate a long article with table-of-contents links and fragment IDs on headings (like a Wikipedia article). You can replicate the bug by following any of the TOC links. Use the attached fruits-toc-links-long-article.html.txt as the body content of a page.
  2. There will be scenarios where core/drupal.tableheader and toolbar/toolbar could each be loaded without the other one, so fragment.js will need to be a core library which both can depend on.
  3. Fragment IDs are not the only things which are accidentally obscured by the toolbar and tableheader. Form elements can be hidden as well. To experience this, you need a form which is much longer than the viewport.
    1. Create 50 nodes with devel_generate.module.
    2. visit admin/content.
    3. Hold down TAB, until your keyboard focus reaches the middle of the list, and the sticky tableheader engages.
    4. Now slowly press Shift-TAB to move focus backwards through the focusable elements (checkboxes, title links, and drop-buttons).
    5. Eventually, keyboard focus will be reach the rows hidden by the sticky table-header.
    6. Scroll with a mousewheel/trackpad, to reveal the focus checkbox under the table header.

    You will not reach this situation by following a fragment ID link, so a hashchange event handler isn't sufficient to fix this scenario. It's a realistic scenario for keyboard users who may need to traverse a form backwards to review their answers. It's mitigated by the fact that the up/down keys can scroll the viewport.

I've made some interdiffs to accompany the recent patches.

andrewmacpherson’s picture

Maybe we could activate the fragment displace behaviour on focus as well as hashchange? fragment,js isn't the best name for in in that case.

andrewmacpherson’s picture

the next step is to adjust the library declarations for toolbar module and core, with offset as a library on it;s own.

BarisW’s picture

Here's a patch that introduces a new core library drupal.fragment.
We still need to thing about the third comment in #33.

BarisW’s picture

Status: Needs work » Needs review
FileSize
4.14 KB
294 bytes

Ah, my previous patch didn't include making the fragments library a dependency of toolbar/toolbar.

Regarding point 3: isn't this out-of-scope for this issue? I tested it, and it's a valid point. But the problem here with fragment navigation and form elements seems tackled.

The last submitted patch, 36: core-js-offset-mess-1870006-36.patch, failed testing. View results

andrewmacpherson’s picture

Status: Needs review » Needs work
FileSize
94.63 KB
102.68 KB

Okay, we'll make #33.3 a follow-up issue. That's about when a form element comes into focus. Probably act on the focus event handler.

Code review of patch #37:

  1. diff --git a/core/core.libraries.yml b/core/core.libraries.yml
    index 5da51e8ae5..ba8b8afb24 100644
    --- a/core/core.libraries.yml
    +++ b/core/core.libraries.yml
    @@ -215,13 +215,25 @@ drupal.form:
       version: VERSION
       js:
         misc/form.js: {}
    +    misc/offset/html5forms.js: {}
       dependencies:
         - core/jquery
         - core/drupal
         - core/drupal.debounce
    +    - core/drupal.displace
    +    - core/drupal.fragment
         - core/jquery.cookie
         - core/jquery.once
    

    core/drupal.displace is itself a dependency of core/drupal.fragment - do we actually have to make core/drupal.form depend on both of them? (I'm not sure what's standard.)

  2. Likewise for core/drupal.tableheader dependencies.
  3. Likewise for toolbar/toolbar dependencies.
  4. core/misc/offset/html5forms.es6.js
    +    setTimeout(function () { window.scrollBy(0, -displace.offsets.top); }, 5);
    

    Need space between minus sign and displace.

  5. core/misc/offset/html5forms.js
    +    setTimeout(function () { window.scrollBy(0, -displace.offsets.top); }, 5);
    

    Need space between minus sign and displace.

  6. fragment.js uses window.scrollTo, but html5forms.js uses window.scrollBy. Is there a reason for using different methods?

Manual testing of patch #37:

  1. Fragment identifier offset works, using my long article test content (attachment fruits-toc-links-long-article.html_.txt in #33). Following a link to a heading ID results in the heading being visible just below the toolbar. GOOD.
  2. There's a quirk when the fragment identifier points to a form element. I tested this with inline form errors module, and @dmsmidt's errorstyle test module, which gives us a nice long form and IFE fragment links. When following an IFE fragment link to a text field, the <input> element comes into view, but the <label> is hidden by the toolbar. This is expected behaviour for what we currently have in <fragment.js, but it would be better if the <label> was brought into view too. Needs work.
  3. A similar quirk with html5forms.js. I followed the steps to reproduce in the current issue summary (node form, jump to bottom, press save, html5 validation kicks in, title field is obscured). The title text input is correctly brought into view, but the label remains hidden under the toolbar. Needs work.
  4. The placement of the html5 native error message differs between browsers. In Firefox 54/linux, html5forms.js brings the text input info view, but leaves the error message pointing to the original position under the toolbar, so the spatial relationship is wrong. In Chrome 59/linux, the error message is placed underneath the text input, and the spatial relationship is fine. I wonder if there's a timing issue here, with the order in which the browser places the message, and carries out the movement from the invalid event firing? I've no idea how to debug that. Screenshots attached for this quirk.

When bringing a form input into view, it would be desirable to bring the label into view too. Maybe we could add an extra step, to check if the element in question is a form input, and if so move the entire div.js-form-item container into view. We can identify them by matching the input ID to the container DIV classes, or to the label's for attribute. I don't know how robust this would be - it could break if a themer customizes the form element templates, say.

I didn't do any keyboard testing, just mouse clicking. Since this all fires on hashchange and invalid JS events, I'm not expecting any difference between keyboard and mouse use. Worth testing before committing though.

I'm really enjoying this issue. It's got some chewy edge cases, but it will make a huge difference when it's right.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

xjm’s picture

Title: Fragment navigation with toolbar + tableheader » HTML5 validation with table sticky header is misaligned over the toolbar
Issue summary: View changes
Issue tags: +Needs issue summary update, +Triaged core major

Here are @andrewmacpherson's screenshots -- are these with the patch applied? If so I think we have more work to do especially for Firefox. :) Thanks @andrewmacpherson for the thorough review!

Firefox

Chrome (less bad)

Can we also add a screenshot for the unpatched state to the summary?

We agreed that this is a major accessibility bug. Thanks @wolffereast for helping triage!

GrandmaGlassesRopeMan’s picture

  1. +++ b/core/misc/offset/fragment.es6.js
    @@ -0,0 +1,26 @@
    +(function ($, Drupal, displace) {
    

    Arrow function and destructure these.

  2. +++ b/core/misc/offset/fragment.es6.js
    @@ -0,0 +1,26 @@
    +  "use strict";
    

    Don't need use strict.

  3. +++ b/core/misc/offset/fragment.es6.js
    @@ -0,0 +1,26 @@
    +  function adjustOffset () {
    

    Arrow function.

  4. +++ b/core/misc/offset/fragment.es6.js
    @@ -0,0 +1,26 @@
    +        setTimeout(function () {
    

    Arrow function.

  5. +++ b/core/misc/offset/html5forms.es6.js
    @@ -0,0 +1,13 @@
    +(function (displace) {
    

    Arrow function and destructure.

  6. +++ b/core/misc/offset/html5forms.es6.js
    @@ -0,0 +1,13 @@
    +  "use strict";
    

    Don't need use strict.

  7. +++ b/core/misc/offset/html5forms.es6.js
    @@ -0,0 +1,13 @@
    +  document.addEventListener('invalid', function (event) {
    

    Arrow function.

  8. +++ b/core/misc/offset/html5forms.es6.js
    @@ -0,0 +1,13 @@
    +    setTimeout(function () { window.scrollBy(0, -displace.offsets.top); }, 5);
    

    Arrow function.

  9. +++ b/core/misc/offset/html5forms.es6.js
    @@ -0,0 +1,13 @@
    +})(Drupal.displace);
    

    Pass `Drupal`.

GrandmaGlassesRopeMan’s picture

GrandmaGlassesRopeMan’s picture

Status: Needs work » Needs review
jay11377’s picture

Issue summary: View changes
FileSize
67.99 KB
69.87 KB
jay11377’s picture

After applying the patch, I didn't see any difference. It is exactly as on the screenshot

jcnventura’s picture

jcnventura’s picture

Status: Needs review » Needs work

Note that the invalid scrollby in the html5forms component ALWAYS triggers. If you press 'save' while the title is visible, the window will still scroll, which is not the intended behaviour.

dmsmidt’s picture

Please note that there is a discussion going to disable HTML5 form errors altogether here #1797438: HTML5 validation is preventing form submit and not fully accessible.
But probably only for Seven and Bartik themes, I expect a framework managers input there soon.

andrewmacpherson’s picture

Version: 8.5.x-dev » 8.4.x-dev

As a major bug report, this should still be eligible for 8.4.x
Requeing tests.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

nod_’s picture

Version: 8.8.x-dev » 9.1.x-dev
Kumar Kundan’s picture

Assigned: Unassigned » Kumar Kundan
Kumar Kundan’s picture

I have gone through the issue and did some research over it, which was already mentioned in the above comments.
I believe that it's more of a browser issue. I will continue my analysis & will post if I find something new.

Kumar Kundan’s picture

Assigned: Kumar Kundan » Unassigned

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Renrhaf’s picture

Hi! Patch seems very promising, thank you!

After testing, it seems it's not perfect yet though : popup not properly placed, the form label is not shown, comment #48 note, etc.
I would like to talk about the "scroll-padding" CSS property that could lead to a simple CSS solution here (see https://css-tricks.com/almanac/properties/s/scroll-padding/).

@alexpott said in https://www.drupal.org/project/drupal/issues/2808699#comment-12099307 that a CSS solution could be preferable, and I totally agree. So, here is a patch with this approach instead of using Javascript.

Here is the result on my Drupal website with Firefox : https://res.cloudinary.com/renrhaf/image/upload/v1605212825/1870006-1_nq...
Note that I have increased by 30 pixels the amount of margin on my local installation for better result : https://res.cloudinary.com/renrhaf/image/upload/v1605212827/1870006-2_it...

Renrhaf’s picture

Status: Needs work » Needs review
ranjith_kumar_k_u’s picture

The above patch works fine.
Before patch (Chrome)
before patch chrome

After Patch (Chrome)
after patch chrome

Before patch (Firefox)
before patch firefox

After patch (Firefox)
after patch firefox

nod_’s picture

+++ b/core/modules/toolbar/css/toolbar.module.css
@@ -278,3 +278,13 @@ body.toolbar-tray-open.toolbar-vertical.toolbar-fixed {
+  scroll-padding-top: 39px; /* Amount of padding toolbar gives to body */

nice, we should fill this value with JS and not hardcode it in CSS, otherwise we're likely to run into some troubles. Using Drupal.displace().top in the JS

tedfordgif’s picture

Does having the CSS as fallback break the JS approach? Why not have both? I realize that is not adding much to the conversation.

piyuesh23’s picture

Needed this patch with Drupal 8.9.x. Adding a re-rolled patch here for 8.9.x.

nod_’s picture

New approach, based on #59 (Great solution by the way), made generic to work with toolbar/tableheader and works for links with fragment, html5 errors

extect’s picture

#65 works really nice. Thank you!

Just one thought: How about themes that add a sticky navbar? How can they make sure they won't run into the same problem as core's toolbar?

nod_’s picture

As long as they use the displace API they should be fine.

vikashsoni’s picture

Apply patch and working fine sharing the screenshot of chrome and Firefox browser

sokru’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Patch in #65 looks elegant and this is big improvement for editor experience. Manually tested with Claro and Seven themes.

Renrhaf’s picture

+1 RTBC ! Thanks @nod_ for finalizing the patch :)

Gauravvvv’s picture

Attached after patch screenshot for Safari browser. seems fine to me.
RTBC +1

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 65: core-js-offset-1870006-65.patch, failed testing. View results

Gauravvvv’s picture

Status: Needs work » Reviewed & tested by the community

Random test fails for #65, Moving to RTBC again.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 65: core-js-offset-1870006-65.patch, failed testing. View results

nod_’s picture

failure seems to be more than something random, not sure why yet.

nod_’s picture

Status: Needs work » Reviewed & tested by the community
Spokje’s picture

larowlan’s picture

Status: Reviewed & tested by the community » Needs review

According to caniuse, scroll-padding is ignored for fragments in Safari, and doesn't work at all in IE11.

Are we happy with that compromise?

Assuming that Safari will get fixed at some point and that we don't need to provide identical experiences in IE.

nod_’s picture

considering code size/complexity vs. number of browsers that gets fixed I'm happy with this compromise. For IE/Safari it doesn't make it worst (and for safari even if fragment don't work, it should work for HTML5 errors as the title of this issue mentions so not a total loss).

After 8 years, a 2kb patch that fix chrome/FF/Edge is too good to pass up. Perfect is the enemy of good here.

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

Assuming nod_ wanted to re RTBC this

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 65: core-js-offset-1870006-65.patch, failed testing. View results

catch’s picture

Status: Needs work » Reviewed & tested by the community

Restoring status after HEAD was broken.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 65: core-js-offset-1870006-65.patch, failed testing. View results

Gauravvvv’s picture

Status: Needs work » Reviewed & tested by the community

Random unrelated failure, moving back to RTBC

alexpott’s picture

Version: 9.3.x-dev » 9.2.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 9ec511c812 to 9.3.x and 8cb35ba074 to 9.2.x. Thanks!

I manually tested this in both chrome and firefox and it definitely improves things. There is another issue in firefox where the html5 error callout doesn't move when you scroll but that is a separate issue and it is not caused by this change. The firefox issue is https://bugzilla.mozilla.org/show_bug.cgi?id=643758

Leaving as 9.2.x because this is a JS change and being cautious.

  • alexpott committed 9ec511c on 9.3.x
    Issue #1870006 by nod_, BarisW, alwaysworking, Renrhaf, pk188,...

  • alexpott committed 8cb35ba on 9.2.x
    Issue #1870006 by nod_, BarisW, alwaysworking, Renrhaf, pk188,...

Status: Fixed » Closed (fixed)

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