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

#10158 painless accessibility improvements #10159

Conversation

fkellner
Copy link
Contributor

@fkellner fkellner commented Apr 4, 2024

Description

Tiny changes that improve accessibility. Should hopefully not take longer than a minute to review.

What kind of change does this PR introduce?

  • Bugfix

Issue

What is the current behavior?

#10158

Bad Lighthouse Accessibility Score

What is the new behavior?

Better Lighthouse Accessibility Score through:

  • Setting Document language
  • Fixing a heading that should be a div
  • providing a logo with an alt tag
  • linking scale label with its form element
  • enabling browser zoom

Breaking change

Does this PR introduce a breaking change?

  • No

Other useful information

Too much Zoom does seem to break the layout, but handing that responsibility to the end user is more accessible for people who need larger controls than
disabling it. Map zoom is unaffected, and since using browser zoom enlarges map controls, users who tried zooming
into the map using browser zoom should be able to notice the actual controls and recover from their mistake.

Florian Kellner added 3 commits April 4, 2024 11:23
Too much Zoom does seem to break the layout, but handing that responsibility to the end user is more accessible than
disabling it. Map zoom is unaffected, and since using browser zoom enlarges map controls, users who tried zooming
into the map using browser zoom should be able to notice the actual controls and recover from their mistake.

On Behalf of DB Systel
- Convert heading that, semantically, should not be a heading, to a div
- correctly assign label to scalebox
- add alt tag to attribution logo

On Behalf of DB Systel
@tdipisa tdipisa linked an issue Apr 4, 2024 that may be closed by this pull request
1 task
@tdipisa tdipisa added External Contribution enhancement BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch labels Apr 4, 2024
@tdipisa tdipisa added this to the 2024.01.01 milestone Apr 4, 2024
@tdipisa
Copy link
Member

tdipisa commented Apr 4, 2024

@fkellner thank you so much for your contribution. We will review as soon as possible.
@allyoucanmap, let's evaluate a possible inclusion in 2024.01.01 (waiting for the review).

@tdipisa tdipisa removed the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Apr 4, 2024
@tdipisa tdipisa removed this from the 2024.01.01 milestone Apr 4, 2024
Copy link
Contributor

@allyoucanmap allyoucanmap left a comment

Choose a reason for hiding this comment

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

@fkellner thanks for the contribution, most of the changes are good, there is just to review how we set the lang in the Localized component

@@ -37,6 +37,7 @@ class Localized extends React.Component {
if (typeof children === 'function') {
children = children();
}
document.documentElement.setAttribute("lang", this.props.locale);
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to move this in componentDidMount and componentDidUpdate and remove it from the render method, it could be something like:

componentDidMount() {
    this.updateDocumentLangAttribute();
}

componentDidUpdate(prevProps) {
    if (this.props.locale !== prevProps.locale) {
        this.updateDocumentLangAttribute();
    }
}

updateDocumentLangAttribute() {
    if (document?.documentElement) {
        document.documentElement.setAttribute("lang", this.props.locale);
    }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the helpful review! Sorry for taking so long, I no longer work at DB Systel.

As requested, the document language is now set when the component is mounted or the language is changed instead of with every rerender.
@fkellner fkellner force-pushed the feat_10158_painless_accessibility_improvements branch from b05cd29 to 375292a Compare September 10, 2024 20:08
@tdipisa
Copy link
Member

tdipisa commented Sep 11, 2024

@fkellner is this PR ready for a new review then? Thank you so much.

@tdipisa tdipisa added the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Sep 11, 2024
@tdipisa tdipisa added this to the 2024.02.00 milestone Sep 11, 2024
@fkellner
Copy link
Contributor Author

Yes, I did the requested changes and it is ready from my side

@allyoucanmap allyoucanmap merged commit 6f6b28a into geosolutions-it:master Sep 13, 2024
6 checks passed
@allyoucanmap
Copy link
Contributor

@ElenaGallo please test on dev and let me know if we can backport on 2024.02.xx, thanks

@ElenaGallo
Copy link
Contributor

Test passed, @allyoucanmap please backport on 2024.02.xx. Thanks

allyoucanmap pushed a commit to allyoucanmap/MapStore2 that referenced this pull request Sep 16, 2024
…ns-it#10159)

* geosolutions-it#10158: set HTML document language

On Behalf of DB Systel

* geosolutions-it#10158: re-enable browser zoom

Too much Zoom does seem to break the layout, but handing that responsibility to the end user is more accessible than
disabling it. Map zoom is unaffected, and since using browser zoom enlarges map controls, users who tried zooming
into the map using browser zoom should be able to notice the actual controls and recover from their mistake.

On Behalf of DB Systel

* geosolutions-it#10158: Tiny Accessibility Fixes

- Convert heading that, semantically, should not be a heading, to a div
- correctly assign label to scalebox
- add alt tag to attribution logo

On Behalf of DB Systel

* geosolutions-it#10158: set HTML document language once per mount/update

As requested, the document language is now set when the component is mounted or the language is changed instead of with every rerender.

---------

Co-authored-by: Florian Kellner <[email protected]>
@tdipisa tdipisa removed the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Sep 16, 2024
tdipisa pushed a commit that referenced this pull request Sep 16, 2024
* #10158: set HTML document language

On Behalf of DB Systel

* #10158: re-enable browser zoom

Too much Zoom does seem to break the layout, but handing that responsibility to the end user is more accessible than
disabling it. Map zoom is unaffected, and since using browser zoom enlarges map controls, users who tried zooming
into the map using browser zoom should be able to notice the actual controls and recover from their mistake.

On Behalf of DB Systel

* #10158: Tiny Accessibility Fixes

- Convert heading that, semantically, should not be a heading, to a div
- correctly assign label to scalebox
- add alt tag to attribution logo

On Behalf of DB Systel

* #10158: set HTML document language once per mount/update

As requested, the document language is now set when the component is mounted or the language is changed instead of with every rerender.

---------

Co-authored-by: fkellner <[email protected]>
Co-authored-by: Florian Kellner <[email protected]>
offtherailz pushed a commit that referenced this pull request Oct 18, 2024
* #10158: set HTML document language

On Behalf of DB Systel

* #10158: re-enable browser zoom

Too much Zoom does seem to break the layout, but handing that responsibility to the end user is more accessible than
disabling it. Map zoom is unaffected, and since using browser zoom enlarges map controls, users who tried zooming
into the map using browser zoom should be able to notice the actual controls and recover from their mistake.

On Behalf of DB Systel

* #10158: Tiny Accessibility Fixes

- Convert heading that, semantically, should not be a heading, to a div
- correctly assign label to scalebox
- add alt tag to attribution logo

On Behalf of DB Systel

* #10158: set HTML document language once per mount/update

As requested, the document language is now set when the component is mounted or the language is changed instead of with every rerender.

---------

Co-authored-by: Florian Kellner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WCAG Accessibility Improvements - Low Hanging Fruits
4 participants