Disabled and readonly form element attributes should be boolean HTML5 attributes

Created on 18 September 2023, over 1 year ago

Problem/Motivation

The code in FormBuilder::handleInputElement():

    if (!empty($element['#disabled'])) {
      if (!empty($element['#allow_focus'])) {
        $element['#attributes']['readonly'] = 'readonly';
      }
      else {
        $element['#attributes']['disabled'] = 'disabled';
      }
    }

These should actually be boolean attributes:

    if (!empty($element['#disabled'])) {
      if (!empty($element['#allow_focus'])) {
        $element['#attributes']['readonly'] = TRUE;
      }
      else {
        $element['#attributes']['disabled'] = TRUE;
      }
    }

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component
Form 

Last updated about 9 hours ago

Created by

🇺🇸United States dave reid Nebraska USA

Live updates comments and jobs are added and updated live.
  • html5

    Implements and supports the use of HTML5.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024