Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1071)

Side by Side Diff: ui/webui/resources/js/util.js

Issue 2388413002: MD History: Announce search results for screen-reader users (Closed)
Patch Set: announceAccessibleMessage Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // <include src="assert.js"> 5 // <include src="assert.js">
6 6
7 /** 7 /**
8 * Alias for document.getElementById. Found elements must be HTMLElements. 8 * Alias for document.getElementById. Found elements must be HTMLElements.
9 * @param {string} id The ID of the element to find. 9 * @param {string} id The ID of the element to find.
10 * @return {HTMLElement} The found element or null if not found. 10 * @return {HTMLElement} The found element or null if not found.
(...skipping 17 matching lines...) Expand all
28 28
29 /** 29 /**
30 * Add an accessible message to the page that will be announced to 30 * Add an accessible message to the page that will be announced to
31 * users who have spoken feedback on, but will be invisible to all 31 * users who have spoken feedback on, but will be invisible to all
32 * other users. It's removed right away so it doesn't clutter the DOM. 32 * other users. It's removed right away so it doesn't clutter the DOM.
33 * @param {string} msg The text to be pronounced. 33 * @param {string} msg The text to be pronounced.
34 */ 34 */
35 function announceAccessibleMessage(msg) { 35 function announceAccessibleMessage(msg) {
36 var element = document.createElement('div'); 36 var element = document.createElement('div');
37 element.setAttribute('aria-live', 'polite'); 37 element.setAttribute('aria-live', 'polite');
38 element.style.position = 'relative'; 38 element.style.position = 'fixed';
39 element.style.left = '-9999px'; 39 element.style.left = '-9999px';
40 element.style.height = '0px'; 40 element.style.height = '0px';
41 element.innerText = msg; 41 element.innerText = msg;
42 document.body.appendChild(element); 42 document.body.appendChild(element);
43 window.setTimeout(function() { 43 window.setTimeout(function() {
44 document.body.removeChild(element); 44 document.body.removeChild(element);
45 }, 0); 45 }, 0);
46 } 46 }
47 47
48 /** 48 /**
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 case 0xdb: return '['; 479 case 0xdb: return '[';
480 case 0xdd: return ']'; 480 case 0xdd: return ']';
481 } 481 }
482 return 'Unidentified'; 482 return 'Unidentified';
483 } 483 }
484 }); 484 });
485 } else { 485 } else {
486 window.console.log("KeyboardEvent.Key polyfill not required"); 486 window.console.log("KeyboardEvent.Key polyfill not required");
487 } 487 }
488 // </if> /* is_ios */ 488 // </if> /* is_ios */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698