Skip to content

Add <noscript> tag & hide map from screenreaders. - #96

Open
Sardis93 wants to merge 1 commit into
open-y-subprojects:5.xfrom
Sardis93:5.x
Open

Add <noscript> tag & hide map from screenreaders.#96
Sardis93 wants to merge 1 commit into
open-y-subprojects:5.xfrom
Sardis93:5.x

Conversation

@Sardis93

@Sardis93 Sardis93 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a fallback message displayed inside a <noscript> tag within the map canvas <div> for users who have JavaScript disabled in their browser. The message is configurable via the existing
Settings form using a text format widget (supporting text formats such as plain text or filtered HTML).

Changes

  • templates/openy-map.html.twig — adds aria-hidden="true" to .openy-map-canvas to hide the interactive map from screen readers, and renders a <noscript> tag inside it when
    #noscript_text is set on the element
  • src/Element/OpenYMap.php — reads noscript_text from config, processes it through check_markup(), and passes the result to the render element as #noscript_text
  • src/Form/SettingsForm.php — adds a text_format field to the admin settings form so editors can customise the message and choose a text format
  • config/install/openy_map.settings.yml — ships a sensible default value (plain_text format)
  • config/schema/openy_map.schema.yml — declares noscript_text as a mapping of value (translatable text) and format (string)
  • openy_map.installopeny_map_update_8010() backfills the new config key for existing installations

Test plan

  • verify the default message appears in source when JS is disabled
  • Settings form: change the message and text format, save, verify the updated text appears in source
  • With JS enabled: confirm the <noscript> content is not visible to the user

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.

1 participant