Skip to content

Name a checkbox without a label by its accessible name - #362

Closed
rezabakhshilaktasaraei wants to merge 1 commit into
desktop-app:masterfrom
rezabakhshilaktasaraei:checkbox-fallback-name
Closed

Name a checkbox without a label by its accessible name#362
rezabakhshilaktasaraei wants to merge 1 commit into
desktop-app:masterfrom
rezabakhshilaktasaraei:checkbox-fallback-name

Conversation

@rezabakhshilaktasaraei

Copy link
Copy Markdown
Contributor

Checkbox::accessibilityName() returns the label text, so a checkbox or radio button created without one — the correct answer button beside a poll answer, where the answer stands for the label — had no name for a screen reader and no way to be given one. Fall back to the widget's accessible name when the label is empty. Labelled checkboxes are unchanged.

The name of a checkbox for a screen reader is its label, and a checkbox
created without one - beside a poll answer, where the answer stands for
the label - had no name at all, with no way to give it one. Fall back to
the widget's accessible name when the label is empty.
Comment thread ui/widgets/checkbox.h
Comment on lines +212 to +216
// A checkbox with no label of its own - beside a poll answer, in a
// list row - is named by what stands for it, through the widget's
// accessible name.
const auto text = _text.toString();
return text.isEmpty() ? RpWidget::accessibilityName() : text;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong, accessible name always takes the priority over this method

@rezabakhshilaktasaraei

Copy link
Copy Markdown
Contributor Author

You're right, QAccessibleWidget::text(Name) already returns the accessible name before Checkbox::accessibilityName() is consulted, so the fallback can never change the result. Verified with NVDA that the poll box radios are named without it; the poll box sets the name on the radio directly and that path is enough. Closing.

@rezabakhshilaktasaraei
rezabakhshilaktasaraei deleted the checkbox-fallback-name branch September 13, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants