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).

1  
!7
2  
3  
// 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.
4  
5  
html {
6  
  bool show = eq("1", params.get("show"));
7  
  ret (show ? "" : hcss([[
8  
    #screenreadertrick {
9  
      position: absolute !important; /* Outside the DOM flow */
10  
      height: 1px; width: 1px; /* Nearly collapsed */
11  
      overflow: hidden;
12  
      clip: rect(1px 1px 1px 1px); /* IE 7+ only support clip without commas */
13  
      clip: rect(1px, 1px, 1px, 1px); /* All other browsers */
14  
    }
15  
  ]])) + hdiv("", "aria-live" := "polite", "aria-atomic" := "true", 
16  
    "aria-relevant" := "all", id := "screenreadertrick")
17  
  + "Screenreader should now give you the current time in seconds every 10 seconds."
18  
  + loadJQuery()
19  
  + hscript([[
20  
    function doIt() {
21  
      var text = new Date().getSeconds() + " seconds";
22  
      console.log(text);
23  
      $("#screenreadertrick").html(text);
24  
    }
25  
    setInterval(doIt, 5000);
26  
  ]]);
27  
}

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: 157 / 708
Version history: 4 change(s)
Referenced in: [show references]