Is <p>&nbsp;</p> to add spacing in website content bad for accessibility?

Example: <h3>Title</h3> <p>Stuff here</p> … (more paragraphs and stuff) <p>&nbsp;</p> <h3>Next Title</h3> <p>Stuff here</p> Basically the title. Currently in the middle of accessibility remediation for my workplace’s website. There’s a check on our automated tool for “All p elements are not used as headers.” Someone mentioned <p>&nbsp;</p> “is more than likely the cause of this issue.” 🤔 So if it’s bad for accessibility then what are good alternatives to add spacing in page content? I’m a bit confused on this one.
31 Replies
ἔρως
ἔρως4w ago
for accessibility, it should read like an empty paper sheet, because &nbsp; is just a space that doesn't allow the text to break to the next line considering that the w3 org website suggests using &nbsp; for spacing a word (for stylistic reasons ... don't know why anyone would do that), instead of spaces, i conclude it shouldn't be any different from an empty element (for accessibility) https://www.w3.org/WAI/WCAG21/Techniques/failures/F32.html it probably isn't semantically correct, and you probably need an heading there instead of a <p>&nbsp;</p>
Chimi
ChimiOP4w ago
I feel like it’s more of a styling issue where people want to have a section, add an extra space using <p>&nbsp;</p> after the last paragraph before the next heading. Using <br /> is kinda gross too
ἔρως
ἔρως4w ago
use a transparent hr? it's not great, but much better than an "empty" paragraph
Chimi
ChimiOP4w ago
Yeah that can work but if others are doing content creation they’re not really going to be able to do that
ἔρως
ἔρως4w ago
that's true probably will be fine i recommend actually testing it
Chimi
ChimiOP4w ago
Well they can type it in with a WYSIWYG editor but can’t make it transparent without editing the HTML… but maybe if the site CSS was better it would have good spacing between everything I can do it but that’s more work for me to go back and change all of those to <hr> :thinkinghd:
ἔρως
ἔρως4w ago
leave it as-is it's probably fine maybe an awkward pause here and there, for a screenreader
Chimi
ChimiOP4w ago
Yeah I think the scanning tool actually does not pick it up like that person said it did, I’m not sure why they’re putting out conflicting information… Oh well, I will document and then remember to make my own websites better 🤣 Thank you 🙂👍
ἔρως
ἔρως4w ago
probably a buggy tool save the link, it will be useful for you
Chimi
ChimiOP4w ago
It’s not the best tool but it’s a starting point But it shouldn’t be our only tool
ἔρως
ἔρως4w ago
you should always have multiple tools to compare results between them all not all tools test everything
Chimi
ChimiOP4w ago
And manual testing I think this is over everyone’s heads here and I don’t especially feel like being the accessibility encyclopedia for them
ἔρως
ἔρως4w ago
yeah, i know what you mean
Chimi
ChimiOP4w ago
Oh I think the link is talking about spacing between letters and such… let me find an example on our website
ἔρως
ἔρως4w ago
i know it is
Chimi
ChimiOP4w ago
But Drupal randomly injects &nbsp; anyway just like in the link which is REALLY ANNOYING
ἔρως
ἔρως4w ago
im using it to show that the &nbsp;, from an accessibility standpoint, should be fine yeah, plenty of old wysiwyg editors do that bullshit
Chimi
ChimiOP4w ago
I understand It’s not an error per say but a grey area and bad practice to do something like we do
ἔρως
ἔρως4w ago
but why's the tool pointing out stuff but doesn't tell you where the stuff is?
Chimi
ChimiOP4w ago
Well it tells you which page and what the snippets are (unless it’s something like a review item then it doesn’t tell you anything except the page and says “You must manually review this item to see if the issue exists” or whatever…). My organization has the Chrome Extension blocked that allows you to manually scan pages and (ideally?) see where on the page rather than having to hunt them down, but I guess the extension is hot garbage So for this particular success criteria of “All p elements are not used as headers”, I have not actually seen the <p>&nbsp;</p> bit and I’m wondering if it will show up under different success criteria… it’s really annoying because the tool just updated a lot of items on their checklist so I have to hunt down where I think something would be under For that SC I have seen bolded paragraph elements that are not headers or ones that should be, not too hard to figure out…
ἔρως
ἔρως4w ago
🤔 maybe it's a bug
Chimi
ChimiOP4w ago
I’m fairly confident that person who said it’s included under that check doesn’t exactly know, but I’ll have to check later Also I’m deliberating how much I should care in general because I feel like I’ll be wrung out being depended on as the accessibility encyclopedia for them
ἔρως
ἔρως4w ago
if it is detected, according to the example i've sent, it should be a bug in my opinion, you should care about it as long as it is your job: everything else reported to the manager for someone who's better equipped to do the accessibility testing im not saying you're incompetent, but an expert is an expert for a reason
Chimi
ChimiOP4w ago
Right like it’s not up to me to get everyone on board and dictate PDF remediation and other department-wide practices. It’s funny because there’s like no experts in this state gov ecosystem so everyone is thinking “uh… how do we comply with this by next April?” But I have been contemplating taking classes like at Deque University and getting accessibility certifications
ErickO
ErickO4w ago
I doubt it's flagging the space since it is just a space who knows tho, I would say there's 2 criteria they could use to flag it as a p being used as a header - Font size & weight - Length of pararaph if you're using deque (axe) then their algo:
Ensures that paragraph elements do not use italic, bold or font size to give the appearance of headings.
Chimi
ChimiOP4w ago
lol I wish we had access to axe
ErickO
ErickO4w ago
sadge, prolly something similar tho
ἔρως
ἔρως3w ago
i think this is all being done inside the wysiwyg drupal editor
Chimi
ChimiOP3w ago
Yeah I can easily edit the HTML and add bootstrap classes to each element that needs spacing but that’s impractical in the case of our Drupal site Here’s to hoping they come up with a better theme that has better spacing for everything lol I wish I could just edit the CSS files myself 😔
ἔρως
ἔρως3w ago
well, you are doing what you can
Chimi
ChimiOP3w ago
And now Hope is up to date on the Rebecca lore 🤣 Rebecca wants to change something, but cruddy government red tape

Did you find this page helpful?