Skip to content

Commit 2d335c6

Browse files
fix: Remove scroll to bottom requirement for signatures (#29784)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Removes scroll to bottom requirement on signatures Improves the clickElementSafe function [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/29784?quickstart=1) ## **Related issues** Fixes: [#29779](#29779) ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
1 parent 27d2706 commit 2d335c6

File tree

4 files changed

+9
-38
lines changed

4 files changed

+9
-38
lines changed

test/e2e/snaps/test-snap-ethprovider.spec.js

-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ describe('Test Snap ethereum_provider', function () {
143143
await driver.clickElement('#signTypedDataButton');
144144

145145
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);
146-
await driver.clickElementSafe('.confirm-scroll-to-bottom__button');
147146
await driver.clickElementAndWaitForWindowToClose({
148147
text: 'Confirm',
149148
tag: 'button',

test/e2e/webdriver/driver.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -707,12 +707,15 @@ class Driver {
707707
async clickElementSafe(rawLocator, timeout = 1000) {
708708
try {
709709
const locator = this.buildLocator(rawLocator);
710-
711710
const elements = await this.driver.wait(
712711
until.elementsLocated(locator),
713712
timeout,
714713
);
715714

715+
await Promise.all([
716+
this.driver.wait(until.elementIsVisible(elements[0]), timeout),
717+
this.driver.wait(until.elementIsEnabled(elements[0]), timeout),
718+
]);
716719
await elements[0].click();
717720
} catch (e) {
718721
console.log(`Element ${rawLocator} not found (${e})`);

ui/pages/confirmations/components/confirm/footer/footer.test.tsx

-14
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,6 @@ describe('ConfirmFooter', () => {
116116
const confirmButton = getByText('Confirm');
117117
expect(confirmButton).toBeDisabled();
118118
});
119-
120-
it('when the confirmation is a Permit with the transaction simulation setting disabled', () => {
121-
jest.spyOn(confirmContext, 'useConfirmContext').mockReturnValue({
122-
currentConfirmation: permitSignatureMsg,
123-
isScrollToBottomCompleted: false,
124-
setIsScrollToBottomCompleted: () => undefined,
125-
});
126-
const mockStatePermit =
127-
getMockTypedSignConfirmStateForRequest(permitSignatureMsg);
128-
const { getByText } = render(mockStatePermit);
129-
130-
const confirmButton = getByText('Confirm');
131-
expect(confirmButton).toBeDisabled();
132-
});
133119
});
134120

135121
it('invoke required actions when cancel button is clicked', () => {

ui/pages/confirmations/components/confirm/footer/footer.tsx

+5-22
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
TransactionMeta,
3-
TransactionType,
4-
} from '@metamask/transaction-controller';
1+
import { TransactionMeta } from '@metamask/transaction-controller';
52
import { providerErrors, serializeError } from '@metamask/rpc-errors';
63
import React, { useCallback, useState } from 'react';
74
import { useDispatch, useSelector } from 'react-redux';
@@ -32,12 +29,7 @@ import {
3229
///: END:ONLY_INCLUDE_IF
3330
updateCustomNonce,
3431
} from '../../../../../store/actions';
35-
import { selectUseTransactionSimulations } from '../../../selectors/preferences';
36-
37-
import {
38-
isPermitSignatureRequest,
39-
isSIWESignatureRequest,
40-
} from '../../../utils';
32+
import { isSignatureTransactionType } from '../../../utils';
4133
import { useConfirmContext } from '../../../context/confirm';
4234
import { getConfirmationSender } from '../utils';
4335
import { MetaMetricsEventLocation } from '../../../../../../shared/constants/metametrics';
@@ -167,9 +159,7 @@ const Footer = () => {
167159
const dispatch = useDispatch();
168160
const t = useI18nContext();
169161
const customNonceValue = useSelector(getCustomNonceValue);
170-
const useTransactionSimulations = useSelector(
171-
selectUseTransactionSimulations,
172-
);
162+
173163
const { currentConfirmation, isScrollToBottomCompleted } =
174164
useConfirmContext();
175165
const { from } = getConfirmationSender(currentConfirmation);
@@ -187,17 +177,10 @@ const Footer = () => {
187177
return false;
188178
});
189179

190-
const isSIWE = isSIWESignatureRequest(currentConfirmation);
191-
const isPermit = isPermitSignatureRequest(currentConfirmation);
192-
const isPermitSimulationShown = isPermit && useTransactionSimulations;
193-
const isPersonalSign =
194-
currentConfirmation?.type === TransactionType.personalSign;
180+
const isSignature = isSignatureTransactionType(currentConfirmation);
195181

196182
const isConfirmDisabled =
197-
(!isScrollToBottomCompleted &&
198-
!isSIWE &&
199-
!isPermitSimulationShown &&
200-
!isPersonalSign) ||
183+
(!isScrollToBottomCompleted && !isSignature) ||
201184
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
202185
mmiSubmitDisabled ||
203186
///: END:ONLY_INCLUDE_IF

0 commit comments

Comments
 (0)