readthedocs / ext-theme

Read the Docs drop in replacement site templates
2 stars 2 forks source link

Project: create forms are still usable by keyboard when disabled #279

Open agjohnson opened 8 months ago

agjohnson commented 8 months ago

This was a leftover from the project creation view work I did.

While the parent elements are disabled on the automatic or manual creation forms, you can still hit tab to move through and use the underlying elements.

This is likely more like a bug in FUI, the disabled state cascades to child elements visually, but the fields aren't actually disabled to the browser.

To fix this, we probably need to also use the disabled states on the nested form or maybe even fields. The disabled state is currently set here:

https://github.com/readthedocs/ext-theme/blob/8b1f5b9be1ed58e7e88298616ca94b4917005c1b/readthedocsext/theme/templates/projects/import_form.html#L33

Here are a few places where a disabled form might be helpful:

agjohnson commented 7 months ago

We might also do this at the template level and detect when form.is_disabled and just add the disabled class to every element and button in the form?

agjohnson commented 4 months ago

This is likely work that should be lumped in with

We need a good pattern for disabling a <form> instance, which could be done fairly automatically in the crispty SUI templates. There is likely a fix here for keyboard focus in addition.