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

Make Context menu available on Mobile preview/live mode #138

Open
codey-badger opened this issue Jul 1, 2024 · 11 comments
Open

Make Context menu available on Mobile preview/live mode #138

codey-badger opened this issue Jul 1, 2024 · 11 comments

Comments

@codey-badger
Copy link

Hi,
First, thanks for the awesome plugin, it's very useful, it should be a core functionality.

Now, as the title says It would be even better if the Context menu were available on Mobile preview/live mode. Changing to reading view stops the flow when processing the notes. preview/live mode probably is the most common view used by default.

TIA for your time.

@pjeby
Copy link
Owner

pjeby commented Jul 1, 2024

I don't have/use Obsidian on mobile, but on the desktop if I put Obsidian in mobile emulation it comes up just fine. Do note that the context menu will include all the usual context menu items, but "Rename", "Create tag page", "Search", etc. will be at the end.

If it's not working on actual mobile I have no clue what's going on. If it's working in reading view and in the sidebar then Tag Wrangler is definitely running, so I've no idea why it wouldn't work in the context menu in editing mode. (I even tried shrinking my screen to make less room for the menu, and it still shows up, but on a sufficiently small screen you might need to scroll the context menu to see the TW-added items.)

@codey-badger
Copy link
Author

In my case it's the other way around, just on mobile.

Maybe it happens just on Android. I will leave some images in case somebody has the same problem. Let me know it is ok.

Preview/ live view:
Screenshot_20240701-192607_Obsidian

Reading view:
Screenshot_20240701-192707_Obsidian

@pjeby
Copy link
Owner

pjeby commented Jul 2, 2024

This is what I get in mobile emulation, on 1.5.8, 1.6.3, and 1.6.5, in the sandbox:

image

I'm not sure what to suggest here. Did it work in any previous version of Obsidian?

@codey-badger
Copy link
Author

Hi @pjeby ,
here again, I was wondering the same, maybe a release changed the behavior. Regardless, today I can reproduce the 'bug' consistently, maybe it's working as expected but let me know if something can be done.

When using it in mobile (not the emulation) the context menu is shown as expected with all the options as long as the cursor is right next to the tag of interest.
If there's a blank space, or the cursor is positioned in other place of the page, the options of the plugin won't appear after a long press tap.

That's why I'm 'forced' to interrupt workflow and change my view or editing mode given that tapping near the tag will initiate the native 'search tag' function. In 'reading view' this won't happen as the cursor probably is not active.

@pjeby
Copy link
Owner

pjeby commented Sep 14, 2024

If you long-press a tag with the cursor elsewhere, what happens? Does it do the same w/TW disabled?

Arguably, if you can't get a context menu from long-press on a tag at all (with or without TW enabled), unless the cursor is already in it (or if the context menu is actually for the spot where the cursor is), that'd be an Obsidian bug that you can report. Especially since the behavior is correct in mobile emulation, that seems like a divergence in the mobile version.

@codey-badger
Copy link
Author

It's just the TW options that are not shown, this happens to me when the cursor is not right next to the tag. If the long tap happens when the cursor is between, or right next to the tag, it works.

Here's a short video to make it clear (same behavior in a new vault with default settings no community plugins except TW installed and enabled). Thanks in advance.

Screen_Recording_20240913-224652_Obsidian_1.mp4

@pjeby
Copy link
Owner

pjeby commented Sep 14, 2024

At 0:03 in your video a context menu appears, and it has items that are off-screen for some reason. Have you tried scrolling or dragging it up to see what else is on there?

If nothing else, it looks like an Obsidian issue with being able to see/access the whole menu.

@codey-badger
Copy link
Author

Those extra commands where added with Commander plugin. I have tried to scroll but the TW options doesn't appear, after long press tap, unless the cursor is specifically between the tag itself or right next to it.

In this way, it is not the context menu itself but the TW commands. Let me known a better title for the issue, maybe: TW commands doesn't appear in context menu after long press tapping when the cursor is not in the tag itself?

Here's the same behavior in a vault with no other community plugins:

Screen_Recording_20240914-101722_Obsidian_1.mp4

I will ask in the forum later but the behavior is as expected with core Obsidian and the same with other community-plugins-commands that interact with the context/menu editor.

Thanks for your time.

@pjeby
Copy link
Owner

pjeby commented Sep 14, 2024

So my guess at this point then is that in mobile emulation, right-clicking first sets the cursor on the tag, while on the actual mobile device, long-press does not set the cursor on the tag first. That would explain why the behavior's different.

Let me ask you this: if your cursor is not on a heading, but you long-press in a heading, do you get options like "bookmark this heading", and "rename this heading"?

@codey-badger
Copy link
Author

if your cursor is not on a heading, but you long-press in a heading, do you get options like "bookmark this heading", and "rename this heading"?

No, I don't get the options.

Thanks for pointing it out, I really don't use that commands so I didn't notice. If the cursor it's somewhere in the heading section, the options("bookmark this heading", and "rename this heading") are shown after long-pressing a link or a tag in the heading. If the cursor it's elsewhere outside the heading the options are not shown.

Screen_Recording_20240914-195707_Obsidian_1.mp4

The behavior from the video it's reproducible with and without TW enabled. Pls, if possible, let me know how would you title the post for the forum, I will edit and post it ASAP with the gathered information.

Sorry if it's too much videos.

@pjeby
Copy link
Owner

pjeby commented Sep 15, 2024

I would frame the bug report as "Long press on mobile does not set cursor position before triggering context menu", giving the header thing as an example and noting that it also affects other plugins that provide editor-menu enhancements and expect the cursor position to match the long-press position.

A possibly-related bug that still existed in 1.5.8 desktop, but seems to be fixed on 1.7 desktop at least: https://forum.obsidian.md/t/context-menu-on-link-does-not-correctly-position-cursor-in-live-preview-on-task-switch/65315

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