a11y: do not use <label> for readonly single checkbox (#71089) #399
|
@ -767,10 +767,11 @@ class CheckboxWidget(QuixoteCheckboxWidget):
|
|||
data_attrs = ' '.join('%s="%s"' % x for x in attrs.items() if x[0].startswith('data-'))
|
||||
# more elaborate markup so standalone checkboxes can be applied a
|
||||
# custom style.
|
||||
label_tag = 'span' if 'readonly' in self.attrs else 'label'
|
||||
return (
|
||||
htmltext('<label %s>%s<span>' % (data_attrs, checkbox))
|
||||
htmltext('<%s %s>%s<span>' % (label_tag, data_attrs, checkbox))
|
||||
+ str(inline_title)
|
||||
+ htmltext('</span></label>')
|
||||
+ htmltext('</span></%s>' % label_tag)
|
||||
)
|
||||
return checkbox
|
||||
|
||||
|
|
Loading…
Reference in New Issue