1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

ToggleButton: Use label so users can click text (#13876)

This commit is contained in:
David Walsh 2022-03-18 10:16:11 -05:00 committed by GitHub
parent e3ea4f2cd0
commit b5088f65a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -190,7 +190,7 @@ describe('Send ETH from dapp using advanced gas controls', function () {
await driver.clickElement({ text: 'Settings', tag: 'div' });
await driver.clickElement({ text: 'Advanced', tag: 'div' });
await driver.clickElement(
'[data-testid="advanced-setting-show-testnet-conversion"] .settings-page__content-item-col > div > div',
'[data-testid="advanced-setting-show-testnet-conversion"] .settings-page__content-item-col > label > div',
);
const advancedGasTitle = await driver.findElement({
text: 'Advanced gas controls',
@ -198,7 +198,7 @@ describe('Send ETH from dapp using advanced gas controls', function () {
});
await driver.scrollToElement(advancedGasTitle);
await driver.clickElement(
'[data-testid="advanced-setting-advanced-gas-inline"] .settings-page__content-item-col > div > div',
'[data-testid="advanced-setting-advanced-gas-inline"] .settings-page__content-item-col > label > div',
);
windowHandles = await driver.getAllWindowHandles();
extension = windowHandles[0];

View File

@ -1,5 +1,7 @@
.toggle-button {
display: flex;
cursor: pointer;
$self: &;
&__status {

View File

@ -52,7 +52,7 @@ const ToggleButton = (props) => {
const modifier = value ? 'on' : 'off';
return (
<div
<label
tabIndex="0"
onKeyDown={(e) => {
if (e.key === 'Enter') {
@ -82,7 +82,7 @@ const ToggleButton = (props) => {
<span className="toggle-button__label-off">{offLabel}</span>
<span className="toggle-button__label-on">{onLabel}</span>
</div>
</div>
</label>
);
};