AllHarlowsEve 2 points 5y ago
It works fine, and I'm interested to see where you're going with this as a DnD/TTRPG player.
WhatWouldVaderDo 1 points 5y ago
Here's a few thoughts, feel free to ask me to clarify if something doesn't make sense.
You need to use ARIA to let screen readers know that there's a part of your page that updates. The most simple, and less optimal thing to do is mark the divs of your output with the correct attributes (see below). The problem with this approach is a screen reader will get very spammy output. Given how your page is structured right now, the output will read something like "Roll number colon 4. Medium, Standard, 1, colon Failure." This may be what you want, depending if you want the user to hear the settings of the roll every time they press the Butten.
A better thing to do is create a separate div, mark it up with both ARIA attributes and set it's display attribute to none. This allows you to write a custom message to screen readers, which can be more informationally dense, while not disrupting your visual flow. For this div, every time you update the information, you can write a shorter message such as "Roll 5: success." This will allow the user to hear "Roll five colon, success" as soon as they activate the roll button, while allowing them to review the existing on-screen message manually if they want to check the roll settings.
As for which ARIA attributes to use, this gets annoying. To hit most of the major screen reader and browser combinations, you want to add the following attributes to one of the divs mentioned above:
* aria-live = "polite". This tells a screen reader that it should pay attention to this div for updates, and it should not interrupt what the user is doing.
* role = "status". This tells the screen reader that this is the important status on the page (mainly here for compatibility reasons).
* aria-atomic = "true". This tells the screen reader to read the entire message again, not only the things that have changed.
The above will work with pretty much all screen readers, with the exception of the combination of VoiceOver, the built-in screen reader on Macs, and the Chrome browser. That particular screen reader is obnoxiously difficult to get working exactly how you want it. I can explain if you want, but what I've already given will work well enough.
bradley22 1 points 5y ago
It seams to work fine. Although I'm not sure if you could use aria to alert the blind user about their stats. So instead of going out of forms mode or focus mode, the modes used when screen readers encounter forms to type in; you would just here alert, then the information that is shown on the screen.