Skip to content

Commit

Permalink
accessibility: make ids of community settings' delete buttons unique
Browse files Browse the repository at this point in the history
  • Loading branch information
fenekku committed Dec 6, 2023
1 parent 99f6677 commit 4f0a603
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const DeleteButton = (props) => {
if (modalOpen) cancelBtnRef?.current?.focus();
}, [modalOpen, cancelBtnRef]);

const { label, confirmationMessage } = props;
const { label, confirmationMessage, id } = props;

return (
<>
Expand All @@ -60,7 +60,7 @@ export const DeleteButton = (props) => {
aria-haspopup="dialog"
aria-controls="warning-modal"
aria-expanded={modalOpen}
id="delete-button"
id={id}
>
<Icon name="trash" />
{label}
Expand All @@ -69,7 +69,7 @@ export const DeleteButton = (props) => {
<Modal
id="warning-modal"
role="dialog"
aria-labelledby="delete-button"
aria-labelledby={id}
open={modalOpen}
onClose={handleClose}
size="tiny"
Expand Down Expand Up @@ -99,4 +99,5 @@ DeleteButton.propTypes = {
onError: PropTypes.func.isRequired,
label: PropTypes.string.isRequired,
confirmationMessage: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class DeleteCommunityModal extends Component {
aria-haspopup="dialog"
aria-controls="warning-modal"
aria-expanded={modalOpen}
id="delete-button"
id="delete-community-button"
>
<Icon name="trash" />
{label}
Expand All @@ -178,7 +178,7 @@ export class DeleteCommunityModal extends Component {
<Modal
id="warning-modal"
role="dialog"
aria-labelledby="delete-button"
aria-labelledby="delete-community-button"
open={modalOpen}
onClose={this.closeConfirmModal}
size="tiny"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ const LogoUploader = ({ community, defaultLogo, hasLogo, onError, logoMaxSize })
</label>
{logoExists && (
<DeleteButton
id={"delete-picture-button"}

Check failure on line 121 in invenio_communities/assets/semantic-ui/js/invenio_communities/settings/profile/LogoUploader.js

View workflow job for this annotation

GitHub Actions / Tests (3.8, pypi, postgresql13, opensearch2)

Curly braces are unnecessary here

Check failure on line 121 in invenio_communities/assets/semantic-ui/js/invenio_communities/settings/profile/LogoUploader.js

View workflow job for this annotation

GitHub Actions / Tests (3.8, pypi, postgresql13, elasticsearch7)

Curly braces are unnecessary here

Check failure on line 121 in invenio_communities/assets/semantic-ui/js/invenio_communities/settings/profile/LogoUploader.js

View workflow job for this annotation

GitHub Actions / Tests (3.9, pypi, postgresql13, opensearch2)

Curly braces are unnecessary here

Check failure on line 121 in invenio_communities/assets/semantic-ui/js/invenio_communities/settings/profile/LogoUploader.js

View workflow job for this annotation

GitHub Actions / Tests (3.9, pypi, postgresql13, elasticsearch7)

Curly braces are unnecessary here
label={i18next.t("Delete picture")}
confirmationMessage={
<Header as="h2" size="medium">
Expand Down

0 comments on commit 4f0a603

Please sign in to comment.