Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fieldset should support readonly attribute #10293

Open
pfteter opened this issue Apr 23, 2024 · 0 comments
Open

Fieldset should support readonly attribute #10293

pfteter opened this issue Apr 23, 2024 · 0 comments
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest topic: forms

Comments

@pfteter
Copy link

pfteter commented Apr 23, 2024

What problem are you trying to solve?

Fieldset supports the disabled attribute.
Setting the disabled attribute disables automatically all it's children.

<fieldset disabled>
    <legend>Choose your favorite monster</legend>
    <input type="radio" id="kraken" name="monster" value="K" />
    <label for="kraken">Kraken</label><br />
  </fieldset>

Demo

this is a useful Feature when creating a form manager together with form association.

The form controls support the readonly attribute too, it would make sense to propagate the readonly attribute from the fieldset controls as it's done with the disabled attribute.

Use Case: In a form disable a whole part of a form or make it readonly

<fieldset readonly>
    <legend>Choose your favorite monster</legend>
    <input type="text" id="kraken" name="monster" value="Readonly value" />
    <label for="kraken">Kraken</label><br />
  </fieldset>

What solutions exist today?

Setting disabled on a fieldset automatically disables all controls that support it. A very similar attribute readonly needs to be set manually on all controls.

How would you solve it?

Add support for the readonly attribute on fieldset that would work in a similar way as disabled - propagate readonly to all its children

Anything else?

Only concern is not all controls support readonly, but neither do all html elements disabled.
This would make sense to use for web components that have form association implemented to be handled through a form manager - for example dynamic forms / form builder.

@pfteter pfteter added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest labels Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest topic: forms
Development

No branches or pull requests

2 participants