Place an (invisible) cursor at the beginning of the active list item

This change is to support screen readers which use the cursor location
to indicate the focus to the user.

Brick.putCursor is unreleased, so grab the latest version from git via extra-deps.
This commit is contained in:
Mario Lang
2021-07-23 11:53:28 +02:00
parent 80e1924e5f
commit 761b8cc750
3 changed files with 6 additions and 3 deletions

View File

@@ -171,7 +171,7 @@ ui dimAttrs BrickState{ appSettings = as@BrickSettings{}, ..}
| elem Latest lTag && not lInstalled =
withAttr "hooray"
| otherwise = id
active = if b then forceAttr "active" else id
active = if b then putCursor "GHCup" (Location (0,0)) . forceAttr "active" else id
in hooray $ active $ dim
( marks
<+> padLeft (Pad 2)
@@ -259,7 +259,7 @@ app attrs dimAttrs =
, appHandleEvent = eventHandler
, appStartEvent = return
, appAttrMap = const attrs
, appChooseCursor = neverShowCursor
, appChooseCursor = showFirstCursor
}
defaultAttributes :: Bool -> AttrMap