Skip to content

Commit

Permalink
Merge pull request #21126 from rezkiy37/fix/19721-protected-pdf-autofill
Browse files Browse the repository at this point in the history
Fix autofill for a protected PDF file in Safari
  • Loading branch information
Julesssss authored Jun 22, 2023
2 parents 18d62d0 + 5a23eeb commit 9bef507
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/PDFView/PDFPasswordForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import compose from '../../libs/compose';
import withLocalize, {withLocalizePropTypes} from '../withLocalize';
import withWindowDimensions, {windowDimensionsPropTypes} from '../withWindowDimensions';
import shouldDelayFocus from '../../libs/shouldDelayFocus';
import * as Browser from '../../libs/Browser';
import CONST from '../../CONST';

const propTypes = {
/** If the submitted password is invalid (show an error message) */
Expand Down Expand Up @@ -104,7 +106,11 @@ class PDFPasswordForm extends Component {
</View>
<TextInput
label={this.props.translate('common.password')}
autoComplete="off"
/**
* This is a workaround to bypass Safari's autofill odd behaviour.
* This tricks the browser not to fill the username somewhere else and still fill the password correctly.
*/
autoComplete={Browser.getBrowser() === CONST.BROWSER.SAFARI ? 'username' : 'off'}
autoCorrect={false}
textContentType="password"
onChangeText={this.updatePassword}
Expand Down

0 comments on commit 9bef507

Please sign in to comment.