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

Feat/toggle flags w cmd #2093

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Feat/toggle flags w cmd #2093

wants to merge 12 commits into from

Conversation

noahonyejese
Copy link
Contributor

@noahonyejese noahonyejese commented Feb 11, 2025

What Changes?
This PR adds a keyboard command handler in order to allow users to toggle the debug flag by entering toggledebug

How to test

  1. Go to this link
  2. enter toggledebug
  3. See how the url changes to have ?flag__debug=true

ps: @bprusinowski not sure if this the preferred approach, was pretty simple 15 min effort, not sure if it works on preview link

  • Add a CHANGELOG entry

Copy link

vercel bot commented Feb 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
visualization-tool ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 25, 2025 8:27am

Copy link
Collaborator

@bprusinowski bprusinowski left a comment

Choose a reason for hiding this comment

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

Thanks for kick-starting this @noahonyejese, I think in general it's a really nice idea 🎉

I tried it in Safari on the preview link and it didn't work (cmd + t opens a new tab, and cmd + d adds a site to bookmarks 😅). I think here I'd avoid using cmd or ctrl + XYZ shortcuts exactly due to this reason, that they can be already assigned to some native browser actions.

I think it would probably be safe to simply type e.g. "enabledebug" that would open the debug panel – also we could consider using a third-party library, https://github.com/chris-feist/use-konami worked well in another project (but it's fine if the current code works) :)

@noahonyejese
Copy link
Contributor Author

@bprusinowski currently it's always crtl + t + d also for mac, there should be no native binding to this for any browser and and operating system. Maybe it makes sense to consider your approach, but rather by @sosiology , @KerstinFaye since it's for them primarily?

@bprusinowski
Copy link
Collaborator

@noahonyejese I've also tried with ctrl, and it didn't work, maybe it's broken in Safari, or I'm doing something wrong 🥹 I personally feel like it should be something natural to remember, that's why I'd prefer to have a "memorable text" (as I also use debug mode often 😅), but if you can make sure it works across browsers, it's also fine 🤞

@noahonyejese
Copy link
Contributor Author

noahonyejese commented Feb 12, 2025

@bprusinowski I see, generally it's maybe not working because of the enable condition? in _app.tsx not sure I thought that is the correct value to determine when to allow it?

The only downside to the text for me is that I never know how much I already typed 😅

@bprusinowski
Copy link
Collaborator

At the moment I'm not sure why it doesn't work, we'd need to investigate 🔍

@noahonyejese noahonyejese self-assigned this Feb 17, 2025
@noahonyejese
Copy link
Contributor Author

@bprusinowski I adjusted this to use konami

@noahonyejese
Copy link
Contributor Author

@bprusinowski is there still something wrong here?

@bprusinowski
Copy link
Collaborator

@noahonyejese I believe the behavior should be that when user types toggledebug, the debug panel icon automatically shows. I see that the relevant part is added to the URL now, but you need to know about this, click on the URL, hit enter, and only then you actually have a debug panel visible 😄 Here I feel like it should only be necessary to enter the text, would it be possible to make it work like this? 🤔

PS. I think the CHANGELOG is wrong now, it still indicates the shortcut method 🔍

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