Issue Task Resolved

#111075Add a disabled state to generic buttons and pseudo button elements

Benjamin Kott 10/15/26, 09:22 updated 10/15/26, 15:05

Description

Problem

A button of the document header cannot be shown disabled when it is a custom element.

  • GenericButton has no disabled state at all. Unlike LinkButton, which renders aria-disabled="true" and the class disabled, it has no setDisabled().
  • The custom elements that act as a button and extend PseudoButtonLitElement (e.g. typo3-qrcode-modal-button, typo3-copy-to-clipboard) ignore the attribute disabled. They stay in the tab order and are activated by a click, Enter and Space. The attribute has no effect on a custom element that is not form-associated, and .btn:disabled does not match it either.
  • typo3-backend-sidebar-toggle and typo3-backend-bookmark-button each work around this on their own by setting aria-disabled and the tab index.

Proposal

  • GenericButton::setDisabled() renders the attribute disabled, and for a tag other than <button> the class disabled for the styles.
  • PseudoButtonLitElement gets a reflected property disabled. While it is set, the element behaves as a disabled <button>: no activation by a click, Enter or Space, tabindex="-1" and aria-disabled="true". A tab index set in the markup stays while the element was never disabled.
  • The sidebar toggle inherits this instead of doing it on its own.

The element leaves the tab order as a disabled <button> does. #104121 discusses the opposite for the bookmark button (focusable while disabled); its review (change 86111) ended undecided, with a preference for the real disabled state. With the state in one place, a later decision there applies to every pseudo button at once.

Use case

The Preview module keeps its document header without a preview (no page selected, a folder, no site) and shows the language selector, the view button and the QR code button disabled. The QR code button is a GenericButton rendering typo3-qrcode-modal-button.

Reviews 2

History 28

  1. Benjamin Kott commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-10-15T15:05:14+00:00" > 10/15/26, 15:05 </span>

    Applied in changeset commit:1689529cd4494c9d9199238d0e302efd92a823bb.