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

iOS password selection #21

Open
nwe44 opened this issue Aug 14, 2012 · 12 comments
Open

iOS password selection #21

nwe44 opened this issue Aug 14, 2012 · 12 comments

Comments

@nwe44
Copy link
Contributor

nwe44 commented Aug 14, 2012

On iOS 5 ( tested on iPad and iPhone) it is currently impossible to select a password generated by oneshallpass.com

@nwe44
Copy link
Contributor Author

nwe44 commented Aug 14, 2012

sorry, this is a duplicate of #15

My mistake.

@nwe44 nwe44 closed this as completed Aug 14, 2012
@maxtaco
Copy link
Owner

maxtaco commented Aug 14, 2012

I know, how do I fix this? Any help would be much appreciated.

On Tue, Aug 14, 2012 at 4:10 PM, Nicholas Evans [email protected]:

On iOS 5 ( tested on iPad and iPhone) it is currently impossible to select
a password generated by oneshallpass.com


Reply to this email directly or view it on GitHubhttps://github.com//issues/21.

@nwe44 nwe44 reopened this Aug 14, 2012
@nwe44
Copy link
Contributor Author

nwe44 commented Aug 14, 2012

Will have a look this eve.

@maxtaco
Copy link
Owner

maxtaco commented Aug 14, 2012

Thanks Nick, any help would be greatly appreciated. It would be even
better to have a way to "copy" to the clipboard but most browsers don't let
you do that without a flash plugin or something horrible like that. I
would be open to changing that DOM element to an input text field too.
Obviously my HTML/JS/CSS is weak and needs serious work.

On Tue, Aug 14, 2012 at 4:13 PM, Nicholas Evans [email protected]:

Will have a look this eve.


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-7738594.

@nwe44
Copy link
Contributor Author

nwe44 commented Aug 15, 2012

Copy to clipboard without resorting to flash is looking promising for browsers that can leverage "contentEditable". Unfortunately, that doesn't quite include iOS 5 or 6 (or below), who will notionally allow javascript to select text whose parent has "contentEditable" turned on, but won't give visual feedback as such, or copy to clipboard. Still, it would be an improvement, so I'll submit a separate pull request with that and try to make it degrade gracefully.

Lastly, apologies for polluting your issue queue with yet another line item, I couldn't figure out Github's interface for directly connecting a pull request to an existing issue.

@maxtaco
Copy link
Owner

maxtaco commented Aug 15, 2012

Thanks so much for the contributions! No problem at all about those
additional issues, I'll clean it up.

On Wed, Aug 15, 2012 at 12:18 PM, Nicholas Evans
[email protected]:

Copy to clipboard without resorting to flash is looking promising for
browsers that can leverage "contentEditable". Unfortunately, that doesn't
quite include iOS 5 or 6 (or below), who will notionally allow javascript
to select text whose parent has "contentEditable" turned on, but won't give
visual feedback as such, or copy to clipboard. Still, it would be an
improvement, so I'll submit a separate pull request with that and try to
make it degrade gracefully.

Lastly, apologies for polluting your issue queue with yet another line
item, I couldn't figure out Github's interface for directly connecting a
pull request to an existing issue.


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-7760575.

@nwe44
Copy link
Contributor Author

nwe44 commented Aug 15, 2012

A quick up date.

Looks like the select button can sort of be made to work in iOS 5, but currently needs to work differently for iOS 6.

So the following,

function fnSelect(obj) {
    fnDeSelect();
    var range;
    var text = obj.firstChild;
    if (browser.mobsafari) {
        obj.contentEditable = "true"; // hack to allow selection
        range = document.createRange();
        range.selectNode(text);
        window.getSelection().addRange(range);
        obj.contentEditable = "false"; // this line breaks the implementation in iOS 6 beta 2
    } else if (document.selection) {
        range = document.body.createTextRange();
        range.moveToElementText(text);
        range.select();
    } else if (window.getSelection) {
        range = document.createRange();
        range.selectNode(text);
        window.getSelection().addRange(range);
    } 
}

Will select the password in iOS 5, but not bring up the popover menu to copy it to clipboard. Also, while it has an implementation of the clipboardData API, it has no setDate method implementation (http://www.w3.org/TR/html5/dnd.html#dom-datatransfer-setdata). Which seems fairly conclusive to me.

iOS 6, currently in beta 4, meanwhile, will do all of the above, and add the popover to let you copy the text. It also raises the keyboard, which iOS 5 does not do. The moment one switches off the contentEditable attribute, everything goes away again. So the above code results in a flicker and nothing more. Who knows what the future will hold.

It may yet be possible to use contentEditable to use the clipboardData API in whatever browsers have setData enabled.
The first stage here seems to be we should sniff for the existence of contentEditable, which the Modernizr guys imply may be tough (https://github.com/Modernizr/Modernizr/wiki/Undetectables).

The search continues...

@maxtaco
Copy link
Owner

maxtaco commented Aug 16, 2012

Thanks so much for this update!

Do you think life would be easier if the DOM element was a text input field rather than or

? github.com seems to use a text input field....

@maxtaco
Copy link
Owner

maxtaco commented Aug 16, 2012

This might be fixed in 6e09d8a (now live on oneshallpass.com) but we need a confirmation from an iphone or ipad.

@nwe44
Copy link
Contributor Author

nwe44 commented Aug 17, 2012

Sorry, no joy on my iPhone; can't select or copy.

Sent from my iPhone

On Aug 16, 2012, at 19:00, Maxwell Krohn [email protected] wrote:

This might be fixed in 6e09d8a (now live on oneshallpass.com) but we need a confirmation from an iphone or ipad.


Reply to this email directly or view it on GitHub.

@maxtaco
Copy link
Owner

maxtaco commented Aug 17, 2012

Hmf, ok.

On Thu, Aug 16, 2012 at 9:17 PM, Nicholas Evans [email protected]:

Sorry, no joy on my iPhone; can't select or copy.

Sent from my iPhone

On Aug 16, 2012, at 19:00, Maxwell Krohn [email protected]
wrote:

This might be fixed in 6e09d8a (now live on oneshallpass.com) but we
need a confirmation from an iphone or ipad.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-7804634.

@rowan-mcalpin
Copy link

Perhaps I'm 12 years late to the party, but copy to clipboard buttons have become highly supported across all mobile (and desktop) browsers.

Relevant w3schools article: https://www.w3schools.com/howto/howto_js_copy_clipboard.asp

I don't know if you are still running/managing this website, but I could probably make a PR in the next few weeks to add this feature, if you'd like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants