Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: Replace Closure UI CSS classes with Blockly CSS classes #8339

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions core/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ export class Menu {
*/
render(container: Element): HTMLDivElement {
const element = document.createElement('div');
// goog-menu is deprecated, use blocklyMenu. May 2020.
element.className = 'blocklyMenu goog-menu blocklyNonSelectable';
element.className = 'blocklyMenu blocklyNonSelectable';
element.tabIndex = 0;
if (this.roleName) {
aria.setRole(element, this.roleName);
Expand Down
21 changes: 7 additions & 14 deletions core/menuitem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,21 @@ export class MenuItem {
this.element = element;

// Set class and style
// goog-menuitem* is deprecated, use blocklyMenuItem*. May 2020.
element.className =
'blocklyMenuItem goog-menuitem ' +
(this.enabled ? '' : 'blocklyMenuItemDisabled goog-menuitem-disabled ') +
(this.checked ? 'blocklyMenuItemSelected goog-option-selected ' : '') +
'blocklyMenuItem ' +
(this.enabled ? '' : 'blocklyMenuItemDisabled ') +
(this.checked ? 'blocklyMenuItemSelected ' : '') +
(this.highlight
? 'blocklyMenuItemHighlight goog-menuitem-highlight '
? 'blocklyMenuItemHighlight '
: '') +
(this.rightToLeft ? 'blocklyMenuItemRtl goog-menuitem-rtl ' : '');
(this.rightToLeft ? 'blocklyMenuItemRtl ' : '');

const content = document.createElement('div');
content.className = 'blocklyMenuItemContent goog-menuitem-content';
content.className = 'blocklyMenuItemContent';
// Add a checkbox for checkable menu items.
if (this.checkable) {
const checkbox = document.createElement('div');
checkbox.className = 'blocklyMenuItemCheckbox goog-menuitem-checkbox';
checkbox.className = 'blocklyMenuItemCheckbox ';
content.appendChild(checkbox);
}

Expand Down Expand Up @@ -188,19 +187,13 @@ export class MenuItem {
*/
setHighlighted(highlight: boolean) {
this.highlight = highlight;

const el = this.getElement();
if (el && this.isEnabled()) {
// goog-menuitem-highlight is deprecated, use blocklyMenuItemHighlight.
// May 2020.
const name = 'blocklyMenuItemHighlight';
const nameDep = 'goog-menuitem-highlight';
if (highlight) {
dom.addClass(el, name);
dom.addClass(el, nameDep);
} else {
dom.removeClass(el, name);
dom.removeClass(el, nameDep);
}
}
}
Expand Down
Loading