The rte plugin that you need to override is KeyPlugin present at /etc/clientlibs/granite/coralui2/optional/rte/js/core/plugins/KeyPlugin.js
.
Around line 254 when it creates the <br>
element, add your attribute using
newBr.setAttribute('aria-hidden', true);
Debug Tip: You can set a debug point in Chrome on this file and change the code at runtime (search for KeyPlugin) /etc/clientlibs/granite/coralui2/optional/rte.js
Once you do this, on click of dialog ok, you can see <br aria-hidden="true">
being posted to the server in the network console.
After this you'll probably run into Sling's XSS protection which strips off this attribute from the resulting HTML. Look for this log
org.apache.sling.xss.impl.HtmlToHtmlContentContext AntiSamy warning: The br tag contained an attribute that we could not process. The aria-hidden attribute has been filtered out, but the tag is still in place. The value of the attribute was "true".
I know of two ways to deal with that.
- Use the 'unsafe' context in sightly.
- Override
/libs/sling/xss/config.xml
and modify the validation of <br>
tag.
class
. WAI is a W3C standard, was expecting it to work. – Sandeep Kumar