Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable form submit manually for passwordless Safari #1968

Merged
merged 1 commit into from
Mar 1, 2021

Conversation

adamjmcgrath
Copy link
Contributor

Changes

The passwordless login window does not honor the "mustAcceptTerms" flag set to true on Safari. A user is still able to hit the return key to send the magic link. (note that the submit button remains correctly disabled). This issue is not present on the latest version of chrome.

Lock relys on the submit button being disabled to prevent a user from submitting the form when they hit Enter.

This works on Chrome and forms with more than one field (which is why it only effects Passwordless), but Safari has a rule that states: If you have one text input Safari will submit the form regardless of a disabled submit button. If you have two text inputs or more Safari will not submit the form if the submit button is dsiabled.

We can manually prevent the form from submitting by adding an additional check for props.disableSubmitButton - which should make the browsers behave the same. The risk is that we get a false positive if props.disableSubmitButton is inadvertently set to true, but I can't see anywhere in Lock where that would be the case.

References

Safari bugs: https://bugs.webkit.org/show_bug.cgi?id=9756 and https://bugs.webkit.org/show_bug.cgi?id=16886
fixes #1967

Testing

I've added some unit tests and checked that the regular Login/Signup forms are not inadvertently blocked when the mustAcceptTerms is disabled and the user switches between form types.

Checklist

@adamjmcgrath adamjmcgrath added the review:small Small review label Feb 26, 2021
@adamjmcgrath adamjmcgrath requested a review from a team as a code owner February 26, 2021 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review:small Small review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mustAcceptTerms not honoured on latest version of safari
2 participants