browser_markup_accessibility_new_selection.js (1133B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 // Test inspector markup view handling new node selection that is triggered by 8 // the user keyboard action. In this case markup tree container must receive 9 // keyboard focus so that further interactions continue within the markup tree. 10 11 add_task(async function () { 12 const { inspector } = await openInspectorForURL( 13 "data:text/html;charset=utf-8,<h1>foo</h1><span>bar</span>" 14 ); 15 const markup = inspector.markup; 16 const doc = markup.doc; 17 const rootContainer = markup.getContainer(markup._rootNode); 18 19 is( 20 doc.activeElement, 21 doc.body, 22 "Keyboard focus by default is on document body" 23 ); 24 25 await selectNode("span", inspector, "test"); 26 is(doc.activeElement, doc.body, "Keyboard focus remains on document body."); 27 28 await selectNode("h1", inspector, "test-keyboard"); 29 is( 30 doc.activeElement, 31 rootContainer.elt, 32 "Keyboard focus must be on the markup tree conainer." 33 ); 34 });