When you save a new action and you forgot to fill out the field the popup message "please fill out this field" is goes at the top of the back button of the browser or on top of the Drupal menu depending on the (height of the browser) instead of at the top of field. Issue observed in Chrome 43, Firefox 38 and IE11

Comments

roaldumandal’s picture

Title: Popup message is on the top of browser » Popup message is on the top of the button of browser
roaldumandal’s picture

Issue summary: View changes
emma.maria’s picture

Component: Bartik theme » Seven theme
Assigned: roaldumandal » Unassigned

The screenshot shows the Seven admin theme. Moving this issue over to that component.

gaurav_varshney’s picture

Component: Seven theme » action.module
Status: Active » Needs review
StatusFileSize
new625 bytes

This issue is not the seven theme. this is because the label is not required when adding action. this is present in action module.

swetashahi’s picture

StatusFileSize
new102.6 KB

Tested with the patch on 8.0.0-alpha14 using Simplytest.me on Firefox browser (v38.0.1) and the popup "Please fill out this field" appears below the erring field.

Please refer below
ss

swetashahi’s picture

Status: Needs review » Reviewed & tested by the community
manjit.singh’s picture

Issue tags: +SrijanSprintDay
manjit.singh’s picture

Status: Reviewed & tested by the community » Needs work

I dont think it should be in RTBC. Now Popup is coming over the toolbar section, Ideally page should be scroll to that point/field when any field got missed by an author.

Balneum’s picture

Agreed with @Manjit.Singh that it should scroll to the correct point. At the moment the popup is in the correct place but the page doesn´t scroll to the field.

Balneum’s picture

StatusFileSize
new97.13 KB

The scroll works in mobile.

gaurav_varshney’s picture

Status: Needs work » Needs review
lewisnyman’s picture

Issue tags: +frontend

I'm not sure if we should be marking fields required when they aren't to fix a UI bug. Is this a browser bug? Does it happen in Chrome?

manjit.singh’s picture

StatusFileSize
new680.14 KB

@lewis adding a screencast :) Please check this.

manjit.singh’s picture

Issue tags: +SrijanSprintNight
darol100’s picture

Version: 8.0.0-alpha14 » 8.0.0-beta11
Status: Needs review » Needs work

I have test this patch and does not scroll up like @Manjit.Singh mention on comment #8. For this reason, I would change it back to "Needs Work". I personally, did not see any different with or without the patch. I test it out on a Google Chrome Version 43.0.2357.81 (64-bit) (Macbook Pro), and Fire Fox Developer Edition 40.0a2 (2015-05-29).

I'm changing the version to the latest version, which is beta 11.

manjit.singh’s picture

@darol100 Thanks for the feedback. Actually that was just a suggestion from myside that When there was any validation error in a form then page should be scroll to that point/field.
With this, I think we can enhance the D8 functionality.

Also Screencast is just showing the popup issue.

swetashahi’s picture

Issue summary: View changes
pakmanlh’s picture

StatusFileSize
new164.22 KB
new119.49 KB

After applied the patch I don't see any difference between before and after.
I think the redirection is working but in the desktop resolutions, the toolbar's height is hidding the field and make a weird effect because the message is showed but the field remains under the toolbar.
Desktop resolution
Mobile resolution
I have no clue which would be the solution.

andypost’s picture

Version: 8.0.0-beta11 » 8.7.x-dev
daniel_rempe’s picture

Status: Needs work » Closed (works as designed)
StatusFileSize
new30.79 KB
new22.31 KB

Tested with Firefox 64, Chromium 71, IE 11 and Chrome 71 / FF 65 on Android. Seems to work as designed. Please reopen this issue if it still occurs.

reenreenreen’s picture

Status: Closed (works as designed) » Active
Issue tags: +ContributionWeekend2019

Error still exists exactly like in the Screencast from Comment Comment #13. Tested with Chrome and Firefox.

In my opinion the issue can only be solved with Javascript.

Approach would be:

  1. find the first :invalid field in the DOM
  2. check if the 'admin menu' is displayed as sidebar
  3. If not: scroll to the label of the invalid field minus the 'admin menu' height
reenreenreen’s picture

Issue tags: -bartik theme +Seven theme
reenreenreen’s picture

Status: Active » Needs work

The following code can be executed in the browser console and should solve the problem in most cases. Unfortunately, I don't know where I can insert the code in the Seven theme.

jQuery(document.body).on('click', '[type="submit"]', function(){
    const $submitButton = jQuery(this);
    const $form = $submitButton.closest('form');

    // check if the toolbar is horizontal and check if an invalid field exists
    if(jQuery(document.body).hasClass('toolbar-horizontal') && $form.find(':invalid').length) {
        const $adminToolbar = jQuery('#toolbar-administration');
        const toolbarHeight = $adminToolbar.find('#toolbar-bar').height();
        const toolbarTrayHeight = $adminToolbar.find('.toolbar-tray.is-active').height();
        const adminToolbarHeight = toolbarHeight + toolbarTrayHeight;
        const $firstInvalidField = $form.find(':invalid').not('fieldset').first();
        const $firstInvalidFieldLabel = $firstInvalidField.prev('label');
        const firstInvalidFieldOffset = parseInt($firstInvalidField.offset().top);
        const firstInvalidFieldLabelHeight = $firstInvalidFieldLabel.height();

        // scroll to the first invalid field 
        window.scrollTo(0, firstInvalidFieldOffset - adminToolbarHeight - firstInvalidFieldLabelHeight);		
    }
});
elaman’s picture

Component: action.module » forms system
Issue tags: -Seven theme

The issue is browser specific. For example, Safari browser doesn't show popup at all.
Also, this isn't a theme or module specific issue, virtually any form on any theme has this issue.

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

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

lucuhb’s picture

When I add the js code from #23 in my custom theme as a new library, this solve the problem, thanks @reenreenreen

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

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

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

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.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.

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.

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.

quietone’s picture

Status: Needs work » Closed (cannot reproduce)

@roald.umandal, Thank you for reporting this problem. We rely on issue reports like this to improve Drupal core.

Both #18 and #20 could not reproduce the problem. I tested this on 9.3.x, standard install, with Firefox 78.14.0esr and Chromium 90.0.4430.212-1 and was not able to reproduce this error. I tested with adding a node and adding an action.

Therefore, closing as cannot reproduce. If you are experiencing this problem reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").

Thanks!