fix(surveys): #23937 disables interactivity on templates, fixes click targets #24420
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Fixes the issue of the survey templates appearing interactive when they are being presented for selection only.
Changes
Sets pointer-events to none for the templates, and sets tabindex for each container. However, this didn't solve the problem of a user still being able to tab through the individual elements of the survey templates. This also varies depending on whether user's focus is 'active' in the top navbar or the main page body. (See Loom video below).
https://www.loom.com/share/e8c4fbe83c7248808c9859f3d19bc855
To solve this, have introduced the 'inert' attribute. Interactivity and screenreader functionality won't work for the individual template elements, which I believe is ok here as context is provided by title and description. Happy to revert this bit if necessary, although users will be able to tab through child elements again IF they start with the navbar (or anything other than the main body) as active.
Also noticed that the click target for each template included its title and description, but wasn't surrounded by a red focus border, which may be confusing for users trying to click outside of the templates, or copy/paste the text etc. (See this referenced in Loom above too).
Does this work well for both Cloud and self-hosted?
Shouldn't have an impact.
How did you test this code?
Checked manually in Chrome vs current prod. Checked popular browsers using Browserstack. Ran all frontend tests with 'pnpm test:unit'.