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

Set / as default pathname in the input component #18

Open
markomitranic opened this issue Apr 11, 2024 · 1 comment
Open

Set / as default pathname in the input component #18

markomitranic opened this issue Apr 11, 2024 · 1 comment

Comments

@markomitranic
Copy link

Hey gang :)

I wanted to suggest a UX change to the pathname input component. Instead of having it's default state be empty, I'd argue that it should always fallback to /. It should also not contain the beginning / if there is an actual pathname entered. Here is a little demonstration of using my forked component:

slug

It is a small change, but after talking to some of my clients, they all felt that this behaviour felt less weird :D
Its a tiny 3-line change, but I am opening this issue to see if this is something you'd want to see, and if it would in some way screw up your setup :)

@siffogh
Copy link
Contributor

siffogh commented Apr 11, 2024

@markomitranic

Instead of having it's default state be empty, I'd argue that it should always fallback to /.

That makes sense, I missed this because we usually create page documents from the navigator, which sets it by default to "/".

It should also not contain the beginning / if there is an actual pathname entered. Here is a little demonstration of using my forked component:
I disagree here because the idea is that pathname is different from a slug in a way that pathname is absolute and behaves like the window.location.pathname and should always start with /. It might a bit confusing for people used to slugs, but it's how it behaves.
Benefits:

  • Consistency with the empty state.
  • Easy of querying. You can always safely compare filter its value based on a route pathname without any additional changes.

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

No branches or pull requests

2 participants