Skip to content

Commit 95abe82

Browse files
authored
Merge pull request scratchfoundation#5076 from LLK/revert-5017-fix-up-delete-button
Revert "Make delete button accessible"
2 parents 770f381 + 445874c commit 95abe82

File tree

6 files changed

+11
-92
lines changed

6 files changed

+11
-92
lines changed

src/components/delete-button/delete-button.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,11 @@
66
display: flex;
77
align-items: center;
88
justify-content: center;
9-
border-radius: 50%;
109
user-select: none;
1110
cursor: pointer;
1211
transition: all 0.15s ease-out;
1312
}
1413

15-
.delete-button:focus {
16-
outline: none;
17-
box-shadow: 0px 0px 0px 4px $motion-transparent;
18-
}
19-
2014
.delete-button-visible {
2115
display: flex;
2216
align-items: center;
Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,39 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
33
import classNames from 'classnames';
4-
import {defineMessages, injectIntl, intlShape} from 'react-intl';
54

65
import styles from './delete-button.css';
76
import deleteIcon from './icon--delete.svg';
87

9-
const messages = defineMessages({
10-
delete: {
11-
id: 'gui.deleteButton.delete',
12-
description: 'Title of the button to delete a sprite, costume or sound',
13-
defaultMessage: 'Delete'
14-
}
15-
});
16-
17-
const DeleteButtonComponent = ({
18-
className,
19-
intl,
20-
onClick,
21-
setRef,
22-
tabIndex,
23-
...props
24-
}) => (
8+
const DeleteButton = props => (
259
<div
26-
aria-label={intl.formatMessage(messages.delete)}
10+
aria-label="Delete"
2711
className={classNames(
2812
styles.deleteButton,
29-
className
13+
props.className
3014
)}
31-
ref={setRef}
3215
role="button"
33-
tabIndex={tabIndex}
34-
onClick={onClick}
35-
{...props}
16+
tabIndex={props.tabIndex}
17+
onClick={props.onClick}
3618
>
3719
<div className={styles.deleteButtonVisible}>
3820
<img
3921
className={styles.deleteIcon}
40-
draggable={false}
4122
src={deleteIcon}
4223
/>
4324
</div>
4425
</div>
45-
);
4626

27+
);
4728

48-
DeleteButtonComponent.propTypes = {
29+
DeleteButton.propTypes = {
4930
className: PropTypes.string,
50-
intl: intlShape,
5131
onClick: PropTypes.func.isRequired,
52-
setRef: PropTypes.func.isRequired,
5332
tabIndex: PropTypes.number
5433
};
5534

56-
DeleteButtonComponent.defaultProps = {
35+
DeleteButton.defaultProps = {
5736
tabIndex: 0
5837
};
5938

60-
export default injectIntl(DeleteButtonComponent);
39+
export default DeleteButton;

src/components/sprite-selector-item/sprite-selector-item.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import classNames from 'classnames';
22
import PropTypes from 'prop-types';
33
import React from 'react';
44

5-
import DeleteButton from '../../containers/delete-button.jsx';
5+
import DeleteButton from '../delete-button/delete-button.jsx';
66
import styles from './sprite-selector-item.css';
77
import {ContextMenuTrigger} from 'react-contextmenu';
88
import {DangerousMenuItem, ContextMenu, MenuItem} from '../context-menu/context-menu.jsx';

src/containers/delete-button.jsx

Lines changed: 0 additions & 52 deletions
This file was deleted.

test/unit/components/__snapshots__/sprite-selector-item.test.jsx.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ exports[`SpriteSelectorItemComponent matches snapshot when given a number and de
5757
>
5858
<img
5959
className={undefined}
60-
draggable={false}
6160
src="test-file-stub"
6261
/>
6362
</div>
@@ -142,7 +141,6 @@ exports[`SpriteSelectorItemComponent matches snapshot when selected 1`] = `
142141
>
143142
<img
144143
className={undefined}
145-
draggable={false}
146144
src="test-file-stub"
147145
/>
148146
</div>

test/unit/components/sprite-selector-item.test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import {mountWithIntl, shallowWithIntl, componentWithIntl} from '../../helpers/intl-helpers.jsx';
33
import SpriteSelectorItemComponent from '../../../src/components/sprite-selector-item/sprite-selector-item';
4-
import DeleteButton from '../../../src/containers/delete-button.jsx';
4+
import DeleteButton from '../../../src/components/delete-button/delete-button';
55

66
describe('SpriteSelectorItemComponent', () => {
77
let className;

0 commit comments

Comments
 (0)