Replies: 2 comments
-
I remember seeing some discussions about this and horizontal scroll in the context of reflow and accessibility. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
While creating issue #2153, I wondered to myself if there was a way to create a single horizontal scroll bar for all overflowing code blocks on a page, rather than having a bunch of small, separate independent scroll bars on each block. Because then we wouldn't have to make sure that each code block was tab-navigable; it would be a better user experience if the user could just press the arrow keys to scroll to any content in the page, without having to first tab-navigate into the code block.
Then I started wondering how other documentation sites handle code blocks and I discovered that some sites allow the code blocks to wrap the lines of code. Here are some example URLs from a few different documentation sites:
Here are a couple sites that do not do code-wrapping and instead put horizontal scroll bars on each overflowing code block:
The essential difference between these sites is whether they use the
white-space: pre-wrap
CSS rule versuswhite-space: pre
.I can imagine arguments for either approach. I'm curious if folks have thoughts about which approach PST should take. Currently, code blocks do not wrap in PST, but that's possibly for no other reason than that's the default browser behavior for
<pre>
tags, which is what Sphinx outputs.One argument for allowing the code blocks to wrap is that we would not need to make the code blocks focusable. That would automatically solve #2153 because we wouldn't have to worry about putting focus rings around the code blocks. We could also delete about 60 lines of not-super-robust JavaScript that scans the page for things that look like code blocks and puts tab stops on them.
Beta Was this translation helpful? Give feedback.
All reactions