Merge pull request #3393 from InspectorCaracal/patch-22
Make EvMenu options single-column for screenreader mode
This commit is contained in:
commit
c0aaedc51a
1 changed files with 10 additions and 1 deletions
|
|
@ -1206,7 +1206,16 @@ class EvMenu:
|
||||||
else:
|
else:
|
||||||
# add a default white color to key
|
# add a default white color to key
|
||||||
table.append(f" |lc{raw_key}|lt|w{key}|n|le{desc_string}")
|
table.append(f" |lc{raw_key}|lt|w{key}|n|le{desc_string}")
|
||||||
ncols = _MAX_TEXT_WIDTH // table_width_max # number of columns
|
|
||||||
|
# check if the caller is using a screenreader
|
||||||
|
screenreader_mode = False
|
||||||
|
if sessions := getattr(self.caller, 'sessions', None):
|
||||||
|
screenreader_mode = any(sess.protocol_flags.get("SCREENREADER") for sess in sessions.all())
|
||||||
|
# the caller doesn't have a session; check it directly
|
||||||
|
elif hasattr(self.caller, 'protocol_flags'):
|
||||||
|
screenreader_mode = self.caller.protocol_flags.get("SCREENREADER")
|
||||||
|
|
||||||
|
ncols = 1 if screenreader_mode else _MAX_TEXT_WIDTH // table_width_max
|
||||||
|
|
||||||
if ncols < 0:
|
if ncols < 0:
|
||||||
# no visible options at all
|
# no visible options at all
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue