fix: use :focus pseudo class instead of blocklyFocused (#8360)

* bug: removed blocklyFocused from menu.ts and dropdown.ts, changed css style to :focus

* removed blocklyFocused from menu.ts

* resubmit

* core css removed blocklyFocused

* fix core css

* menu file import cleanup, linting error
This commit is contained in:
Skye
2024-07-26 19:16:22 -06:00
committed by GitHub
parent 5d825f0a60
commit af0a724b3e
3 changed files with 2 additions and 12 deletions

View File

@@ -5,7 +5,6 @@
*/
// Former goog.module ID: Blockly.Css
/** Has CSS already been injected? */
let injected = false;
@@ -119,7 +118,7 @@ let content = `
box-shadow: 0 0 3px 1px rgba(0,0,0,.3);
}
.blocklyDropDownDiv.blocklyFocused {
.blocklyDropDownDiv:focus {
box-shadow: 0 0 6px 1px rgba(0,0,0,.3);
}
@@ -445,7 +444,7 @@ input[type=number] {
z-index: 20000; /* Arbitrary, but some apps depend on it... */
}
.blocklyWidgetDiv .blocklyMenu.blocklyFocused {
.blocklyWidgetDiv .blocklyMenu:focus {
box-shadow: 0 0 6px 1px rgba(0,0,0,.3);
}

View File

@@ -136,12 +136,6 @@ export function createDom() {
// Handle focusin/out events to add a visual indicator when
// a child is focused or blurred.
div.addEventListener('focusin', function () {
dom.addClass(div, 'blocklyFocused');
});
div.addEventListener('focusout', function () {
dom.removeClass(div, 'blocklyFocused');
});
}
/**

View File

@@ -15,7 +15,6 @@ import * as browserEvents from './browser_events.js';
import type {MenuItem} from './menuitem.js';
import * as aria from './utils/aria.js';
import {Coordinate} from './utils/coordinate.js';
import * as dom from './utils/dom.js';
import type {Size} from './utils/size.js';
import * as style from './utils/style.js';
@@ -156,7 +155,6 @@ export class Menu {
const el = this.getElement();
if (el) {
el.focus({preventScroll: true});
dom.addClass(el, 'blocklyFocused');
}
}
@@ -165,7 +163,6 @@ export class Menu {
const el = this.getElement();
if (el) {
el.blur();
dom.removeClass(el, 'blocklyFocused');
}
}