Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

browser: jsbuilder: replace button label for span element #10986

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions browser/src/control/Control.JSDialogBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -2303,11 +2303,10 @@ L.Control.JSDialogBuilder = L.Control.extend({

controls['button'] = button;
if (builder.options.noLabelsForUnoButtons !== true) {
var label = L.DomUtil.create('label', 'ui-content unolabel', button);
label.htmlFor = buttonId;
label.textContent = builder._cleanText(data.text);
builder._stressAccessKey(label, button.accessKey);
controls['label'] = label;
var span = L.DomUtil.create('span', 'ui-content unolabel', button);
Copy link
Contributor

@eszkadev eszkadev Jan 22, 2025

Choose a reason for hiding this comment

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

Are we sure we want to remove native "label" type?
It provides automatic information for text-to-speach software what to read and which input field it labels

Copy link
Contributor

Choose a reason for hiding this comment

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

I see it's not for button element: https://www.w3schools.com/tags/tag_label.asp

Copy link
Contributor

Choose a reason for hiding this comment

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

but don't we need to add 'labelled-by' or 'labelFor' then?

Copy link
Member Author

Choose a reason for hiding this comment

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

It does not specify the attribute change in the task description. Please ask Lilly for more details

span.textContent = builder._cleanText(data.text);
builder._stressAccessKey(span, button.accessKey);
controls['label'] = span;
$(div).addClass('has-label');
} else if (builder.options.useInLineLabelsForUnoButtons === true) {
$(div).addClass('no-label');
Expand All @@ -2332,11 +2331,10 @@ L.Control.JSDialogBuilder = L.Control.extend({

if (builder.options.useInLineLabelsForUnoButtons === true) {
$(div).addClass('inline');
label = L.DomUtil.create('span', 'ui-content unolabel', div);
label.htmlFor = buttonId;
label.textContent = builder._cleanText(data.text);
span = L.DomUtil.create('span', 'ui-content unolabel', div);
span.textContent = builder._cleanText(data.text);

controls['label'] = label;
controls['label'] = span;
}
var disabled = data.enabled === 'false' || data.enabled === false;
if (data.command) {
Expand Down Expand Up @@ -2393,10 +2391,10 @@ L.Control.JSDialogBuilder = L.Control.extend({
if (data.selected === true)
selectFn();
} else {
var label = L.DomUtil.create('label', 'ui-content unolabel', div);
label.textContent = builder._cleanText(data.text);
var span = L.DomUtil.create('span', 'ui-content unolabel', div);
span.textContent = builder._cleanText(data.text);
controls['button'] = button;
controls['label'] = label;
controls['label'] = span;
}

if (options && options.hasDropdownArrow) {
Expand Down
Loading