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

Multiple elements with non-unique id #2520

Open
HolgerJeromin opened this issue Jan 26, 2020 · 6 comments
Open

Multiple elements with non-unique id #2520

HolgerJeromin opened this issue Jan 26, 2020 · 6 comments
Labels
bug Something is broken or not working as expected

Comments

@HolgerJeromin
Copy link
Contributor

Chrome complains:

image

This DOM feels not right indeed:
image

@tomhughes
Copy link
Member

This is useless unless you tell us what page you are referring to.

@HolgerJeromin
Copy link
Contributor Author

As this is the main page www.openstreetmap.org with most subpages with map (way, node, relation) I forgot to mention :)

@tomhughes
Copy link
Member

I think this is because there are two different versions of the form, one for the normal view and one for the mobile view, so it's probably not very easy to fix.

I suspect nothing actually uses the ids but rails probably generates them automatically - actual usage is probably via the form field names and hopefully always uses the form that is actually live and visible.

@mmd-osm
Copy link
Contributor

mmd-osm commented Jan 26, 2020

This seems to be related to partial app/views/layouts/_search.html.erb being included twice in app/views/layouts/map.html.erb:

<% content_for :header do %>
  <%= render :partial => "layouts/search", :locals => { :autofocus => false } %>
<% end %>

<% content_for :content do %>
  <div id="sidebar">
    <%= render :partial => "layouts/search", :locals => { :autofocus => true } %>

Header level form was originally (re-)introduced in dd12e1d

@tomhughes
Copy link
Member

Isn't that exactly what I said?

The first one is for the mobile site and the second one for the desktop site.

@mmd-osm
Copy link
Contributor

mmd-osm commented Jan 26, 2020

Yes, you've already mentioned that. I thought it might be interesting to have a bit of context where this happens in the codebase.

@tuckerrc tuckerrc added the bug Something is broken or not working as expected label Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken or not working as expected
Projects
None yet
Development

No branches or pull requests

4 participants