-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Open
Labels
Progress: ready for groomingReported on 2.4.xIndicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.feature request
Description
Description
Currently, the Select, Multiselect and EditableMultisect form elements only supports the disabled attribute at the select element level, which disables the entire dropdown. There is no way to disable individual <option> elements within the select dropdown.
The current option properties supported are: label, value, title, and style. The feature request is to add support for a disabled property that can be passed from the source model to disable specific options while keeping others selectable.
Expected behavior
Support for a disabled key in the option array that accepts a boolean value (true/false)
Benefits
- Better UX: Allows developers to show unavailable options in dropdowns while keeping them visible for context, rather than hiding them completely or disabling the entire select element
- Standard HTML5 Compliance: The
disabledattribute on<option>elements is part of the HTML5 standard and is widely supported across browsers - No Breaking Changes: The feature is additive and maintains full backward compatibility with existing code
- Cleaner Conditional Logic: With native
disabledsupport, conditional option availability can be handled directly in the source model with simple boolean logic, reducingJavaScriptdependencies and improving maintainability
Additional information
Example:
public function toOptionArray(): array
{
return [
[
'value' => 'default',
'label' => __('Default'),
'disabled' => true,
],
];
}Release note
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Progress: ready for groomingReported on 2.4.xIndicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.feature request
Type
Projects
Status
Pull Request in Progress