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

MouseCursor on links #543

Closed
wants to merge 3 commits into from
Closed

Conversation

cgestes
Copy link
Collaborator

@cgestes cgestes commented Oct 16, 2021

This implements hitTestChildren for RenderEditableTextLine.

This also set the mouseCursor to "click" for links and always open links on click. :D
The previous behavior was hard to understand for a user. Some apps do it like this, because you probably want to open a link more than you want to edit it. To edit: just remove it and make another one.
In anycase it seems like a good quickfix before we do something better.

In practice this forward events to RichText & (probably) embeds.
We could use TextSpan gesture detector for handling clicks on link. Your call :)

@cgestes cgestes changed the title WIP: MouseCursor on links MouseCursor on links Oct 17, 2021
@cgestes
Copy link
Collaborator Author

cgestes commented Oct 17, 2021

So just pushed a rebase, with everything figured out.
It is fine to review and merge

The previous behavior is hard to understand, it feels like it's broken. Some apps do it like this, because you probably want to open it much more than to edit it.
In anycase it seems like a good quickfix before we do something better.
Copy link
Contributor

@pulyaevskiy pulyaevskiy left a comment

Choose a reason for hiding this comment

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

Thanks, the fix looks good! Just have one suggestion around change in links behavior.

} else {
// TODO: Implement a toolbar to display the URL and allow to launch it.
// editor.showToolbar();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if we can extract this into a separate PR? I'm not convinced yet this is a good solution for now.

To edit: just remove it and make another one.

This would require keyboard navigation to the linked text, which is pretty annoying, to say the least.

It'd be nice to merge the hitTestChildren fix without waiting on this conversation to get resolved.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok I'll extract

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tried... I don't know what to extract actually. Can you pick the commits you are interested in? they are split properly already.
Changing the mouse cursor imho make sense only if you can actually click. Otherwise it's miss-leading.

The current situation I am trying to fix here: it's impossible to follow or edit a link while editing.
Follow workaround: none I know of. Links are just unusable when editing.
Edit workaround: just remove the text and make a new one.

So I actually believe everything should be merged. It's really small changes that can be easily adapted when we have better support for links.
Also this could be made a plugin so that anyone can pick the appropriate behavior for their cases.

Copy link
Contributor

Choose a reason for hiding this comment

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

Follow workaround: none I know of. Links are just unusable when editing.

Some editors implement link launching in edit mode using the Ctrl+LeftClick (or Cmd+LeftClick for macOS).
Obviously this is not an option for mobile platforms and for those implementing a toolbar with an option to follow the link is probably the most common approach.

That said, if your use case only requires desktop support how about adding the Ctrl+LeftClick support? This is kind of similar to what Web Browsers do for "Open link in new tab" action, which is pretty close to what the user wants here.

For mobile platforms there is also an option of a "Long Tap", by the way, which I've seen being used in some cases. Though usually it also triggers a toolbar, but can be simplified by popping up a modal dialog as a temporary solution.

Copy link
Collaborator

@amantoux amantoux Oct 28, 2021

Choose a reason for hiding this comment

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

My cents on this (the product manager in me speaking):

  • edition mode: I'm editing a link, I don't really need to follow the link (unless I want to check but shouldn't happen that often)
  • read only mode: I just want to follow the link

return body!.hitTest(result, position: position);
});
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice find! 👍

@pulyaevskiy
Copy link
Contributor

I've cherry-picked the hit test fix in #557 and merged. Let me know if you're planning to spend more time on the links support here per our discussion above? Otherwise we can probably close it?

@pulyaevskiy pulyaevskiy deleted the branch memspace:1.0-dev November 26, 2021 22:24
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.

3 participants