Repository navigation
Listbox disabled state (native) - #34
Merged
Merged
Conversation
RobertJoonas
approved these changes
Oct 2, 2026
RobertJoonas
left a comment
Contributor
There was a problem hiding this comment.
Thanks for this! Feels more intuitive indeed to put the disabled attribute on the listbox wrapper itself, and relying on native disabled sounds like a nice simplification too. One suggestion inline though...
Suggestion: do not add `data-disabled` to listbox trigger button at all
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Alternative proposal to #32
The main difference is that instead of managing
aria-disabledandtabindexourselves, we make use of the fact that listbox trigger is rendered as a<button>which comes with a browser native disabled state. In this PR we just render<button disabled="true">and let the browser manage it natively.Second difference is moving the
disabledattribute to the root<.listbox>Prima component and propagates it via JS hook. The original PR mentions a reason not to do this:I agree it's not ideal but it is a reasonable compromise. The UI requires javascript and hooks to be initialized in order to work properly. The listbox won't even open before hooks are initialized. Copying the
disabledattribute while JS hook is initializing only affects the disabled styling, it does not allow some bad behaviour.Putting the
disabledattribute on the root<.listbox>component feels more native like select. It also allows us to render the hidden input withdisabled="true"attribute, which means the input will not be submitted by the browser when disabled, which again aligns better with native form field behaviour.