-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Accessibility improvements for Extensions in Razor Markup #9576
Accessibility improvements for Extensions in Razor Markup #9576
Conversation
Merge latest Umbraco v8 into my repo
…into v8/contrib # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
…nto v8/contrib
…nto v8/contrib
…nto v8/contrib
…nto v8/contrib
…nto v8/contrib
…nto v8/contrib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @RachBreeze,
Thanks for this. It works for me (mostly!)
However, I've found a few things that don't quite work seamlessly.
If I have a rich text editor property and then use ModelsBuilder to obtain the value (which will be an IHtmlString
), the GetMarkUpForFallbackLanguage
method fails, as it relies on the type parameter being a string (or being able to be implicitly cast to from a string), which IHtmlString
is not. This will also likely fail for any other property types (ie int
).
System.InvalidCastException: 'Invalid cast from 'System.String' to 'System.Web.IHtmlString'.'
Secondly, if the type is a string. the result will need to be output wrapped in an Html.Raw
statement to escape the markup. This isn't ideal UX-wise but also poses a security risk as the initial text is not HTML escaped. Unfortunately, it may be suboptimal to simply escape the initial text as this may not be desired by the developers.
Boy, this is a bit of a mine-field, eh?!
I wonder if it might be worth making this a completely different method rather than trying to force it into the Value
/ ValueFor
implementation? I agree something like this is necessary (the workaround at the moment is painful!) but I'm not sure this is the optimal solution either.
Happy to talk through this some time (it may also be worth us chatting to HQ to discuss options here).
Joe
src/Umbraco.Web/Models/PublishedContent/PublishedValueFallback.cs
Outdated
Show resolved
Hide resolved
src/Umbraco.Web/Models/PublishedContent/PublishedValueFallback.cs
Outdated
Show resolved
Hide resolved
src/Umbraco.Web/Models/PublishedContent/PublishedValueFallback.cs
Outdated
Show resolved
Hide resolved
src/Umbraco.Web/Models/PublishedContent/PublishedValueFallback.cs
Outdated
Show resolved
Hide resolved
src/Umbraco.Web/Models/PublishedContent/PublishedValueFallback.cs
Outdated
Show resolved
Hide resolved
Hi @glombek The return of the needs to be part of the fallback options, as it's only the request to use a fall back that means the language could change, and the user would need to be notified of those change. I would need guidance on any new implementations for this. But am happy to do any required changes. It's worth noting that @nul800sebastiaan did advise on the original implementation #9321. I did realise that the code would need wrapping in I have now added type testing to |
Heya I've found another demonstration of why this change is important https://vimeo.com/210258413 |
This fixes the "string" vs "String" issue in the previous commit and prevents the function returning invalid markup
Hi @RachBreeze, I tested your changes today and found a couple of errors. I hope you don't mind but I took the liberty of fixing them for you as they were pretty minor. I think you've nailed the functionality now for different property types and the fallback of simply returning the initial value instead of falling over is much neater. I also fixed the breaking test and merged the latest version of You'll notice in my changes that I didn't use the If you're happy with my changes we can progress. Thanks! |
Hi @glombek the changes look good thank you |
Good morning |
Thanks @RachBreeze - no further action needed on your part, just me you were waiting for! That's merged now and you can expect to see it in 8.16. |
Thank you |
Hi @RachBreeze and @glombek - unfortunately based on some feedback from the team I have reverted this change for the 8.16 release, I'll quote some of the conversation here:
I hope this will help with a re-take of this PR for a future version @RachBreeze but please do ask if you need clarification. Sorry I had to revert this one after it was merged so long ago, but I hope you'll understand we want to do the right thing here. We totally love the idea of this feature of course and we want it, but in a different way. 😅 Thanks so much for your efforts so far and again, let us know if you need some more guidance! |
)" This reverts commit a1e0af6.
This PR is to resolve #9321
It is important for accessibility purposes that the correct natural language is defined on the page via the
<HTML lang="">
element this allows screen readers and other assistive technology use the correct pronunciation when reading the page content (as shown here) https://www.youtube.com/watch?v=QwOoU8T24UY&feature=youtu.beWhere a property on a page hasn't been defined in the user's selected language Umbraco allows the content to fall back as detailed here https://our.umbraco.com/Documentation/Getting-Started/Design/Rendering-Content/#using-fall-back-methods this means that the language defined in the HTML element is potentially not the language of the content in that property.
W3C details more about this issue here https://www.w3.org/International/questions/qa-html-language-declarations#:~:text=Quick%20answer,an%20element%20surrounding%20that%20content. This PR aims to both support the accessibility requirement following the pattern defined in thisarticle in the section "What if there's no element to hang your attribute on?" It also gives the developer the facility to use their discretion as to whether the code should display
<span lang="fallbackLanguage">
...</span>
around the property.I have added "
Fallback.DisplayFallBackLanguage
" as an optional add an additional optional parameter toFallback.To
to support this.The need for this is based on the EU funded research project for improving the process of creating accessible content by authors