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

feat(label+labelGroup): update aria-labels to include label text #8192

Merged
merged 2 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const LabelEditable: React.FunctionComponent = () => {
onEditComplete={onEditComplete}
isEditable
editableProps={{
'aria-label': 'Editable text',
'aria-label': `Editable label with text ${labelText}`,
id: 'editable-label'
}}
>
Expand All @@ -46,7 +46,7 @@ export const LabelEditable: React.FunctionComponent = () => {
onEditComplete={onCompactEditComplete}
isEditable
editableProps={{
'aria-label': 'Compact editable text',
'aria-label': `Editable compact label with text ${compactLabelText}`,
id: 'compact-editable-label'
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const LabelGroupEditableAdd: React.FunctionComponent = () => {
props: {
isEditable: true,
editableProps: {
'aria-label': 'label editable text'
'aria-label': 'Editable label with text Label 3'
}
},
id: 2
Expand All @@ -24,7 +24,12 @@ export const LabelGroupEditableAdd: React.FunctionComponent = () => {

const onEdit = (nextText: string, index: number) => {
const copy = [...labels];
copy[index] = { name: nextText, props: labels[index].props, id: labels[index].id };
const updatedProps = {
...labels[index].props,
editableProps: { 'aria-label': `Editable label with text ${nextText}` }
};

copy[index] = { name: nextText, props: updatedProps, id: labels[index].id };
setLabels(copy);
};

Expand All @@ -35,7 +40,7 @@ export const LabelGroupEditableAdd: React.FunctionComponent = () => {
props: {
isEditable: true,
editableProps: {
'aria-label': 'label editable text'
'aria-label': `Editable label with text New Label`
jenny-s51 marked this conversation as resolved.
Show resolved Hide resolved
}
},
id: idIndex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const LabelGroupEditableAddDropdown: React.FunctionComponent = () => {
props: {
isEditable: true,
editableProps: {
'aria-label': 'label editable text'
'aria-label': 'Editable label with text Label 3'
}
},
id: 2
Expand All @@ -29,7 +29,12 @@ export const LabelGroupEditableAddDropdown: React.FunctionComponent = () => {

const onEdit = (nextText: string, index: number) => {
const copy = [...labels];
copy[index] = { name: nextText, props: labels[index].props, id: labels[index].id };
const updatedProps = {
...labels[index].props,
editableProps: { 'aria-label': `Editable label with text ${nextText}` }
};

copy[index] = { name: nextText, props: updatedProps, id: labels[index].id };
setLabels(copy);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const LabelGroupEditableAddModal: React.FunctionComponent = () => {
props: {
isEditable: true,
editableProps: {
'aria-label': 'label editable text'
'aria-label': 'Editable label with text Label 3'
}
},
id: 6
Expand All @@ -60,7 +60,12 @@ export const LabelGroupEditableAddModal: React.FunctionComponent = () => {

const onEdit = (nextText: string, index: number) => {
const copy = [...labels];
copy[index] = { name: nextText, props: labels[index].props, id: labels[index].id };
const updatedProps = {
...labels[index].props,
editableProps: { 'aria-label': `Editable label with text ${nextText}` }
};

copy[index] = { name: nextText, props: updatedProps, id: labels[index].id };
setLabels(copy);
};

Expand All @@ -81,7 +86,7 @@ export const LabelGroupEditableAddModal: React.FunctionComponent = () => {
isEditable: isEditable !== undefined ? isEditable : true,
...(isEditable && {
editableProps: {
'aria-label': 'label editable text'
'aria-label': `Editable label with text ${labelText || 'New Label'}`
jenny-s51 marked this conversation as resolved.
Show resolved Hide resolved
}
})
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const LabelGroupEditableLabels: React.FunctionComponent = () => {
onEditComplete={newText => setLabel1(newText)}
isEditable
editableProps={{
'aria-label': 'Editable text',
'aria-label': `Editable label with text ${label1}`,
id: 'editable-label-1'
}}
>
Expand All @@ -29,7 +29,7 @@ export const LabelGroupEditableLabels: React.FunctionComponent = () => {
onEditComplete={newText => setLabel2(newText)}
isEditable
editableProps={{
'aria-label': 'Editable text 2',
'aria-label': `Editable label with text ${label2}`,
id: 'editable-label-2'
}}
>
Expand All @@ -42,7 +42,7 @@ export const LabelGroupEditableLabels: React.FunctionComponent = () => {
onEditComplete={newText => setLabel3(newText)}
isEditable
editableProps={{
'aria-label': 'Editable text 3',
'aria-label': `Editable label with text ${label3}`,
id: 'editable-label-3'
}}
>
Expand Down