Skip to content

refactor: prevent logo click reloading homepage if already there #152

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

Merged
merged 5 commits into from
May 24, 2024

Conversation

Jer-Pha
Copy link
Contributor

@Jer-Pha Jer-Pha commented May 24, 2024

This is only necessary if you agree with this comment about it being a design error. There's also the very small impact to bandwidth of an unnecessary page load (pretty insignificant for the site's traffic, though).

A different option is to keep the anchor tag and only adjust the href to "#". This tells users that the logo is clickable without reloading the page.

Jer-Pha added 2 commits May 23, 2024 16:51
…here

Depending on your design philosophy, clicking the logo should not do anything if you are already where it takes you. https://ux.stackexchange.com/a/55642

The conditional could be inside the href property, which would be DRY but also harder to read:

{% url 'index' as index_url %}
<a class="navbar-brand" href="{% if request.path == index_url %}#{% else %}{{ index_url }}{% endif %}">
Depending on your design philosophy, clicking the logo should not do anything if you are already where it takes you. https://ux.stackexchange.com/a/55642
Copy link
Member

@davidfischer davidfischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only necessary if you agree with this comment about it being a design error. There's also the very small impact to bandwidth of an unnecessary page load (pretty insignificant for the site's traffic, though).

I don't feel particularly strongly one way or the other. I'd be fine merging this if we can work out the issues but I don't mind the current functionality either.

A different option is to keep the anchor tag and only adjust the href to "#". This tells users that the logo is clickable without reloading the page.

Given the issues with sizing, that might be a better solution. It also simplifies the {% if %}/{% else %} logic.

Jer-Pha and others added 3 commits May 24, 2024 16:13
The image no longer needs an id because there is no CSS targeting it.
Copy link
Member

@davidfischer davidfischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm glad we got to something we're happy with after a bit of back and forth! This looks good. :shipit:

@davidfischer davidfischer merged commit ab8f708 into sandiegopython:main May 24, 2024
1 check passed
@Jer-Pha Jer-Pha deleted the jer-pha branch May 25, 2024 00:10
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

Successfully merging this pull request may close these issues.

2 participants