Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "use div as legend" config and features value
Let devs replace visible `legend` elems with `div`. Follows accessibility guidelines by using `aria-labelledby` and `id`. Devs can set "use div as legend" in the config file or the same key in the features block to a boolean. The feature block value takes precedence. This will change the visible HTML legend elements to divs. If the dev uses anything other than a boolean, they get an error message. Why change only visible legend elements? It is a smaller change that I thought would be more acceptable. Why ensure always unique random ids? Devs should not rely on the selector. Avoids later breaking changes. Outcome of configuration combinations: - [x] config: none/feature: none - legend - [x] config: false/feature: none - legend - [x] config: true/feature: none - div - [x] config: none/feature: true - div - [x] config: false/feature: true - div - [x] config: true/feature: true - div - [x] config: none/feature: false - legend - [x] config: false/feature: false - legend - [x] config: true/feature: false - legend - [x] config: chair/feature: none - legend - [x] config: chair/feature: true - div - [x] config: chair/feature: false - legend Error messages: - [x] config: chair - websockets.log: The Configuration directive "use div as legend" must be True or False. - [x] feature: chair - webpage: "use div as legend" in "features" must be either True or False. Edited: - docassemble_base/docassemble/base/config.py - docassemble_base/docassemble/base/parse.py - docassemble_base/docassemble/base/standardformatter.py - docassemble_webapp/docassemble/webapp/static/app/app.css - docassemble_webapp/docassemble/webapp/server.py - tests/features/TestExamples.feature Ignored: - docassemble_demo/docassemble/demo/data/static/lumen.min.css: Disabling the styles in the DOM didn't have an effect. - docassemble_webapp/docassemble/webapp/static/bootstrap/css/bootstrap.min.css: Same styles as lumen. - docassemble_webapp/docassemble/webapp/static/app/cm6.js: Treats `div` and `legend` the same. - docassemble_webapp/docassemble/webapp/static/app/jquery.min.js: jQuery uses `legend` in checks for disabled fields. Both `div` and `legend` cannot be disabled and from what I saw in the code I believe jQuery would treat them the same way: https://github.com/jquery/jquery/blob/03e183c4ccf22bf4031920c3270c9f113cb72d1d/src/selector.js#L277 jQuery mentions the spec for disableable elements: https://github.com/jquery/jquery/blob/03e183c4ccf22bf4031920c3270c9f113cb72d1d/src/selector.js#L248-L250 - docassemble_webapp/docassemble/webapp/static/app/MaterialIcons-Regular.json: MaterialIcons icons are independent of the html that uses them. Compiled files (ignored): - docassemble_webapp/docassemble/webapp/static/app/adminbundle.js - docassemble_webapp/docassemble/webapp/static/app/app.min.css - docassemble_webapp/docassemble/webapp/static/app/bundle.css - docassemble_webapp/docassemble/webapp/static/app/bundle.js - docassemble_webapp/docassemble/webapp/static/app/cm6.min.js - docassemble_webapp/docassemble/webapp/static/bootstrap/css/bootstrap.min.css.map I found no a appearances of disabled associated with legends. Co-authored-by: ttiimm <[email protected]>
- Loading branch information