Bug 1862144 - [devtools] Remove A11yIntention component. r=devtools-reviewers,bomsy.

It doesn't do anything we could do with CSS only and might actually cause
issues with our focus indicators.

Depends on D191738

Differential Revision: https://phabricator.services.mozilla.com/D192308
This commit is contained in:
Nicolas Chevobbe 2023-11-02 06:15:37 +00:00
parent ca9f26a192
commit fb52bbafba
8 changed files with 10 additions and 110 deletions

View File

@ -1,7 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
.A11y-mouse :focus {
outline: 0;
}

View File

@ -1,37 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import { Component } from "react";
import { div } from "react-dom-factories";
import PropTypes from "prop-types";
import "./A11yIntention.css";
export default class A11yIntention extends Component {
static get propTypes() {
return {
children: PropTypes.array.isRequired,
};
}
state = { keyboard: false };
handleKeyDown = () => {
this.setState({ keyboard: true });
};
handleMouseDown = () => {
this.setState({ keyboard: false });
};
render() {
return div(
{
className: this.state.keyboard ? "A11y-keyboard" : "A11y-mouse",
onKeyDown: this.handleKeyDown,
onMouseDown: this.handleMouseDown,
},
this.props.children
);
}
}

View File

@ -33,7 +33,6 @@ import "./variables.css";
import "./App.css";
import "./shared/menu.css";
import A11yIntention from "./A11yIntention";
import { ShortcutsModal } from "./ShortcutsModal";
import PrimaryPanes from "./PrimaryPanes";
import Editor from "./Editor";
@ -307,20 +306,16 @@ class App extends Component {
componentName: "Debugger",
panel: L10N.getStr("ToolboxDebugger.label"),
},
React.createElement(
A11yIntention,
{},
this.renderLayout(),
quickOpenEnabled === true &&
React.createElement(QuickOpenModal, {
shortcutsModalEnabled: this.state.shortcutsModalEnabled,
toggleShortcutsModal: () => this.toggleShortcutsModal(),
}),
React.createElement(ShortcutsModal, {
enabled: this.state.shortcutsModalEnabled,
handleClose: () => this.toggleShortcutsModal(),
})
)
this.renderLayout(),
quickOpenEnabled === true &&
React.createElement(QuickOpenModal, {
shortcutsModalEnabled: this.state.shortcutsModalEnabled,
toggleShortcutsModal: () => this.toggleShortcutsModal(),
}),
React.createElement(ShortcutsModal, {
enabled: this.state.shortcutsModalEnabled,
handleClose: () => this.toggleShortcutsModal(),
})
)
);
}

View File

@ -11,7 +11,6 @@ DIRS += [
]
CompiledModules(
"A11yIntention.js",
"App.js",
"QuickOpenModal.js",
"ShortcutsModal.js",

View File

@ -1,35 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React from "react";
import { shallow } from "enzyme";
import A11yIntention from "../A11yIntention";
function render() {
return shallow(
React.createElement(
A11yIntention,
null,
React.createElement("span", null, "hello world")
)
);
}
describe("A11yIntention", () => {
it("renders its children", () => {
const component = render();
expect(component).toMatchSnapshot();
});
it("indicates that the mouse or keyboard is being used", () => {
const component = render();
expect(component.prop("className")).toEqual("A11y-mouse");
component.simulate("keyDown");
expect(component.prop("className")).toEqual("A11y-keyboard");
component.simulate("mouseDown");
expect(component.prop("className")).toEqual("A11y-mouse");
});
});

View File

@ -1,13 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`A11yIntention renders its children 1`] = `
<div
className="A11y-mouse"
onKeyDown={[Function]}
onMouseDown={[Function]}
>
<span>
hello world
</span>
</div>
`;

View File

@ -8,7 +8,6 @@
/* Devtools imports */
@import url("chrome://devtools/content/debugger/src/components/variables.css");
@import url("chrome://devtools/content/debugger/src/components/A11yIntention.css");
@import url("chrome://devtools/content/debugger/src/components/App.css");
@import url("chrome://devtools/content/debugger/src/components/shared/AccessibleImage.css");
@import url("chrome://devtools/content/debugger/src/components/shared/Accordion.css");

View File

@ -285,7 +285,6 @@ devtools.jar:
content/debugger/images/sources/webpack.svg (debugger/images/sources/webpack.svg)
content/debugger/src/debugger.css (debugger/src/debugger.css)
content/debugger/src/components/variables.css (debugger/src/components/variables.css)
content/debugger/src/components/A11yIntention.css (debugger/src/components/A11yIntention.css)
content/debugger/src/components/App.css (debugger/src/components/App.css)
content/debugger/src/components/QuickOpenModal.css (debugger/src/components/QuickOpenModal.css)
content/debugger/src/components/ShortcutsModal.css (debugger/src/components/ShortcutsModal.css)