Skip to content

Form.Element.activate on MobileSafari doesn't select text #301

Open

Description

@savetheclocktower

This makes a unit test fail. Seems related to this StackOverflow issue. Hence the fix could look something like this:

if (Prototype.Browser.MobileSafari) {
  Form.Element.Methods.activate = function (element) {
    element = $(element);
    try {
      element.focus();
      if (element.setSelectionRange && (element.tagName.toLowerCase() != 'input' ||
        !(/^(?:button|reset|submit)$/i.test(element.type))))
      element.setSelectionRange(0, 9999);
    } catch (e) { }
    return element;
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions