Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

27
LINES

< > BotCompany Repo | #1028538 // Trick ScreenReader test (works!)

JavaX source code (desktop) [tags: butter use-pretranspiled] - run with: x30.jar - homepage

Download Jar. Libraryless. Click here for Pure Java version (2689L/17K).

!7

// This gets around a bug in some screenreader + browser combos where on addition of a new message to the chat, the whole chat history is read.

html {
  bool show = eq("1", params.get("show"));
  ret (show ? "" : hcss([[
    #screenreadertrick {
      position: absolute !important; /* Outside the DOM flow */
      height: 1px; width: 1px; /* Nearly collapsed */
      overflow: hidden;
      clip: rect(1px 1px 1px 1px); /* IE 7+ only support clip without commas */
      clip: rect(1px, 1px, 1px, 1px); /* All other browsers */
    }
  ]])) + hdiv("", "aria-live" := "polite", "aria-atomic" := "true", 
    "aria-relevant" := "all", id := "screenreadertrick")
  + "Screenreader should now give you the current time in seconds every 10 seconds."
  + loadJQuery()
  + hscript([[
    function doIt() {
      var text = new Date().getSeconds() + " seconds";
      console.log(text);
      $("#screenreadertrick").html(text);
    }
    setInterval(doIt, 5000);
  ]]);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028538
Snippet name: Trick ScreenReader test (works!)
Eternal ID of this version: #1028538/5
Text MD5: 52cc7391d10676a38de4e603e9cbfbd3
Transpilation MD5: b9287a6643821fa35c13c7f7edf3482c
Author: stefan
Category: javax / web chat bots
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-25 14:20:10
Source code size: 998 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 147 / 688
Version history: 4 change(s)
Referenced in: [show references]