Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Add some <input> types to focusable elements #9476

Closed
TuurDutoit opened this issue Oct 7, 2014 · 14 comments
Closed

Add some <input> types to focusable elements #9476

TuurDutoit opened this issue Oct 7, 2014 · 14 comments

Comments

@TuurDutoit
Copy link
Contributor

In brackets.js, on line 414, there is some code that restricts focusing elements which are descendants of elements with class .no-focus. In that code block, there is a check that always allows focusing of text input elements. But, this only checks for elements with type of text, number, password or no type at all. Since HTML5, though, some types have been added to the spec, like email, url, tel, date, etc. Maybe we should consider adding these, too.

@redmunds
Copy link
Contributor

redmunds commented Oct 7, 2014

I can't think of any input element that this should not apply to, so why even check type attribute?

@TuurDutoit
Copy link
Contributor Author

Radio and checkbox maybe? I have no idea.

@redmunds
Copy link
Contributor

redmunds commented Oct 7, 2014

Right, Mac doesn't support giving focus to buttons (type of submit, reset, button, radio, checkbox, image). But Windows does. Linux?

Probably don't want to give focus to type of hidden so still need to check type.

@TuurDutoit
Copy link
Contributor Author

That's true. For Linux, it depends. I know GTK does.

@JeffryBooher JeffryBooher changed the title Add some <input> types to focussable elements Add some <input> types to focusable elements Oct 27, 2014
@cyberomin
Copy link
Contributor

@redmunds, what's the deal, should I pick this? Will need some guidance though.

@TuurDutoit
Copy link
Contributor Author

@cyberomin First, make your environment ready for hacking. You should find all info here.

Secondly, fix the issue! I'd say, go online and find all the valid input types. w3.org is probably your best bet. They should have the official spec somewhere. Then, add all the types that result in a plain text field to the lines I mentioned in the first post.

Third, commit your changes and open a pull request. Done!

If you have any questions, feel free to post them here!

@cyberomin
Copy link
Contributor

Thanks @TuurDutoit, my environment is setup already. I'll give this a shot. This is my first FOSS contribution though, I still need some hand-holding and mentorship.

@TuurDutoit
Copy link
Contributor Author

It's not that difficult, you'll handle it. And remember: we don't bite ... hard 😃

@marcelgerber
Copy link
Contributor

@TuurDutoit It's probably easier (and easier to maintain) to just enable focussing all input types except checkboxes, hidden ones and radios.

@cyberomin
Copy link
Contributor

@TuurDutoit got it :-) @marcelgerber what will it be? Should I go with what @TuurDutoit suggested?

@redmunds
Copy link
Contributor

@cyberomin I'm not sure how best to handle <input> elements on the mac platform. By default you cannot have focus on buttons, but there is an OS preference that allows it. So, you should start by just adding the specific types requested by bug filer -- those are safe for all platforms.

@eliezerb
Copy link
Contributor

I've been looking at HTML5 spec, that now is a W3C recommendation, and all the allowed values for type attribute are:

Renders as a plain text field:

  • type=text - Included in the source code
  • type=search
  • type=tel
  • type=url
  • type=email
  • type=password - Included in the source code
  • type=date
  • type=time
  • type=number - Included in the source code

Renders as another kind of field:

  • type=hidden
  • type=range
  • type=color
  • type=checkbox
  • type=radio
  • type=file
  • type=submit
  • type=image
  • type=reset
  • type=button

So, is the solution for this bug include all the fields in the first list in the brackets.js file, that still are not there?

@eliezerb
Copy link
Contributor

Hey @redmunds !

I was able to reproduce this issue on Windows and Linux, using a simple extension with all the possible fields. I just did the PR #9915 adding each one of the input types, also tried adding only $target.is("input") and worked just fine on Linux. I don't know how Mac OS X will behave with this situation, but this alternative sounds easier to maintain.

If some of you think that something needs to be improved, please let me know!

Thanks!

@redmunds redmunds added this to the Release 1.1 milestone Dec 2, 2014
redmunds added a commit that referenced this issue Dec 2, 2014
…lements

Adding input types to focusable elements #9476
@redmunds
Copy link
Contributor

redmunds commented Dec 2, 2014

Confirmed. Closing.

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

No branches or pull requests

6 participants