Allow setting of tabindex in presentation layer
|Reported by:||mike@…||Owned by:||nobody|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I needed this for a project that I was working on, and I thought I would put the function here. I am a very new Django user and haven't so much as looked at its source code yet, but if I can get to it after my current project is finished, I'll be happy to contribute this as a proper patch if desired.
Essentially, this is a filter for use on form fields, links, etc. in order to add a tabindex attribute to it. In order to remain light, it doesn't call up an HTML parser, and so it naïvely appends tabindex="X" to the end of the list of attributes. It handles both /> and normal > tag closure, so that it works for both types of tags. If it cannot find an end-of-tag, it returns the input unaltered. Furthermore, if the tabindex parameter is passed in as a string it will attempt conversion to an integer; if that fails, it will also return the input as-is.
Change History (3)
Changed 5 years ago by mike@…
comment:1 Changed 5 years ago by aaugustin
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Design decision needed