CloseButton takes its accessible name from an optional tooltip prop, and these two panes were the only callers that never passed one. Making the prop required stops the next caller repeating it. The a11y_checks annotation this retires was filed as Bug 1849028. Differential Revision: https://phabricator.services.mozilla.com/D325411
34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
/* 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/>. */
|
|
|
|
"use strict";
|
|
|
|
const React = require("devtools/client/shared/vendor/react");
|
|
const { button } = require("devtools/client/shared/vendor/react-dom-factories");
|
|
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
|
|
|
const DebuggerImage = require("devtools/client/shared/components/DebuggerImage");
|
|
|
|
function CloseButton({ handleClick, buttonClass, tooltip }) {
|
|
return button(
|
|
{
|
|
className: buttonClass ? `close-btn ${buttonClass}` : "close-btn",
|
|
onClick: handleClick,
|
|
title: tooltip,
|
|
},
|
|
React.createElement(DebuggerImage, {
|
|
name: "close",
|
|
})
|
|
);
|
|
}
|
|
|
|
CloseButton.propTypes = {
|
|
buttonClass: PropTypes.string,
|
|
handleClick: PropTypes.func.isRequired,
|
|
// The button has no text, so the tooltip is its only accessible name.
|
|
tooltip: PropTypes.string.isRequired,
|
|
};
|
|
|
|
module.exports = CloseButton;
|