Problem/Motivation

The JS lock option adds a 'disabled' prop to a number of form input elements:
$form.find('input, textarea, select').prop('disabled', true).addClass('is-disabled');

However, this does not include all input elements, for example <button> see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled

Steps to reproduce

Add a <button> element to a form. Lock the form using JS lock

Proposed resolution

Disable all input elements with JS lock

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

JS lock disables all input elements.

API changes

None.

Data model changes

None.

Command icon 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:

Comments

idebr created an issue. See original summary.

idebr’s picture

Status: Active » Needs review
StatusFileSize
new727 bytes

Attached patch disables all input elements with JS lock using the jQuery :input selector: https://api.jquery.com/input-selector/

idebr’s picture

Issue summary: View changes
anneke_vde’s picture

Status: Needs review » Reviewed & tested by the community

Tested the patch, the button is now also disabled.

akalam’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new802 bytes

Some themes like Gin have the buttons outside the form and therefore the buttons are not being disabled. Here is a patch with a solution working on all themes.

smustgrave’s picture

Status: Needs review » Needs work

Neither #2 or #5 seem to disable ckeditor5 fields

smustgrave’s picture

Status: Needs work » Reviewed & tested by the community

Actually it does fix the ckeditor and seems to be a wider net then #3396683: CKEditor5 field not getting disabled on locked form.

alexpott’s picture

Status: Reviewed & tested by the community » Needs review

Does this disable the ability to break the lock?

alexpott’s picture

Issue tags: +Needs tests

It would be great to add a test here - specifically around disabling of CKEditor claims.

smustgrave’s picture

So I just did a fresh install with 8.x-2.x and all the changes merged.

And ckeditor5 is now being disabled.

I think this MR is a better selector but could someone confirm?

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Tested on 2 other sites and ckeditor5 fields are now disabled after the recent merges to 8.x-2.x

Think this ticket still provides better selectors though.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Can we have an automated test of this - plus confirmation that this does not disable the unlock button has well.

smustgrave’s picture

Assigned: Unassigned » smustgrave

Will work on trying to add a ckeditor5 field to be tested

smustgrave’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests

Turned the existing body field into a field with a ckeditor5 formatter.

plus confirmation that this does not disable the unlock button has well.

The unblock button doesn't appear when locked. But the "Break lock" link is fine.

smustgrave’s picture

smustgrave’s picture

Rebased

smustgrave’s picture

Hiding patches.

smustgrave’s picture

StatusFileSize
new256.44 KB

break-lock

The break lock link doesn't appear to be disabled.

alexpott’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to go.

  • alexpott committed 9a6e8334 on 8.x-2.x authored by smustgrave
    Issue #3320771 by smustgrave, idebr, akalam, alexpott: Disable all input...
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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