Skip to content

Conversation

@AprilSylph
Copy link
Owner

@AprilSylph AprilSylph commented Nov 11, 2025

Description

Adds a new option to Tweaks that modifies the "Create" button on the desktop layout to navigate straight to /new/text instead of the /new interstitial with the post type bubbles.

To help achieve this elegantly, the reusable onClickNavigate handler has been modified to stop event propagation when a modifier key is detected, or we have entered the codepath that calls navigate(). This hides the element from React's event processing, making the element behave more like one that we've created ourselves—forcing it to follow what the DOM href is, and not the React virtual DOM link target.

We only use onClickNavigate in one other place, Tag Tracking+, where this change has no effect at all. If we do ever need to build something where we do need click events on internal links to bubble... we can worry about that when we get there! (Probably just two variations of the same reusable handler; the only unknown there would be the naming.)

Testing steps

Setup

  1. Load the modified addon
  2. Enable Tweaks
  3. Enable the new option

Feature testing – Desktop layout

  1. Hover the Create button
    • Expected result: The link target is https://www.tumblr.com/new/text
  2. Click the Create button
    • Expected result: The post form is opened immediately, with no interstitial
    • Expected result: The post form is empty, with no media upload placeholders
  3. Control+click the Create button (Command+click on macOS)
    • Expected result: https://www.tumblr.com/new/text is opened in a new tab
  4. Shift+click the Create button
    • Expected result: https://www.tumblr.com/new/text is opened in a new window

Regression testing – Mobile layout

  1. Open the navigation drawer
  2. Hover the Create button
    • Expected result: The link target is https://www.tumblr.com/new
  3. Click the Create button
    • Expected result: The navigation drawer is closed
    • Expected result: The post form is opened immediately, with no interstitial
    • Expected result: The post form is empty, with no media upload placeholders

@marcustyphoon
Copy link
Collaborator

Do we want to make the button continue to target the current community when on a communities page?

@AprilSylph
Copy link
Owner Author

Do we want to make the button continue to target the current community when on a communities page?

I had absolutely no idea that that was a thing. That's fun.

@marcustyphoon
Copy link
Collaborator

We could make the selector ${keyToCss('createPostButton')}[href$="/new"], which sort of seems like an elegant anti-weird-behavior guard, but I don't imagine it's likely to make any difference.

Copy link
Collaborator

@marcustyphoon marcustyphoon left a comment

Choose a reason for hiding this comment

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

Works as expected!

@AprilSylph
Copy link
Owner Author

AprilSylph commented Nov 12, 2025

We could make the selector ${keyToCss('createPostButton')}[href$="/new"], which sort of seems like an elegant anti-weird-behavior guard, but I don't imagine it's likely to make any difference.

We actually want to re-process buttons (which this would prevent) when the addon restarts, since onClickNavigate expires if the previous addon sandbox is thrown away. But we can do .href.replace(/\/new$/, '/new/text') instead, which I think is a good idea.

@marcustyphoon
Copy link
Collaborator

Oh, yeah, I guess that would prevent reprocessing! Can't have that.

@AprilSylph AprilSylph merged commit e1f3b87 into master Nov 12, 2025
5 checks passed
@AprilSylph AprilSylph deleted the aprilsylph/create-button-text-tweak branch November 12, 2025 10:53
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.

create button opens text post

3 participants