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

Show Guides Index as selected for / on small screens [ci-skip] #45277

Merged
merged 1 commit into from
Jun 14, 2022

Conversation

p8
Copy link
Member

@p8 p8 commented Jun 6, 2022

Summary

On small screens the guides index is shown as a select dropdown.
If the window.location matches the value of an option, it will be selected.

The first option in the select is "Guides Index" and has the value 'index.html'.
When visiting https://guides.rubyonrails.org/index.html this option is selected.
When visiting https://guides.rubyonrails.org/ this option won't be
selected as the pathname doesn't include index.html.

Javascript treats empty strings as falsey, so for the root path we can
return index.html instead of an empty string.
This makes sure the "Guides Index" is selected as well.

Before

image

After

image

On small screens the guides index is shown as a select dropdown.
The Guides Index option has the value 'index.html'.
When visiting `https://guides.rubyonrails.org/` this option won't be
selected as the pathname doesn't include index.html.

Javascript treats empty strings as falsey, so for the root path we can
return `index.html` instead of a empty string.
@rails-bot rails-bot bot added the docs label Jun 6, 2022
@eileencodes eileencodes merged commit 9817c94 into rails:main Jun 14, 2022
@p8 p8 deleted the guides/fix-guide-dropdown-on-home branch August 18, 2022 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants