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

Link-hint mode command options (incl. hover, focus) #3097

Merged
merged 1 commit into from
Feb 21, 2020

Conversation

smblott-github
Copy link
Collaborator

This adds:

map X LinkHints.activateMode action=hover
map X LinkHints.activateMode action=focus
map X LinkHints.activateMode action=copy-text

For "hover", <Escape> generates the mouseout event.

This adds:

    map X LinkHints.activateMode action=hover
    map X LinkHints.activateMode action=focus
    map X LinkHints.activateMode action=copy-text

For "hover", `<Escape>` generates the `mouseout` event.
@gdh1995
Copy link
Contributor

gdh1995 commented Aug 24, 2018

In order to make mouseout and mouseover work well, we need to set event.relatedTarget before dispatching them, because some pages use this to show/hide popup menus:
image

Doc: https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/relatedTarget

@smblott-github
Copy link
Collaborator Author

Thanks, @gdh1995.

So, setting relatedEvent to what? The parent element?

Ideally, if you could give me a commit that I can cherry pick, then that would be perfect.

@gdh1995
Copy link
Contributor

gdh1995 commented Aug 24, 2018

relatedEvent should be the element moving "from" or "to".

I have no enough rest time today, and if you wait a commit from me, it will be in 8 hours.

BTW, according to https://developer.mozilla.org/en-US/docs/Web/Events/mouseout , event.detail should be 0 for mouseout nad mousemove events - this line should need change:

mouseEvent.initMouseEvent(event, true, true, window, 1, 0, 0, 0, 0, modifiers.ctrlKey, modifiers.altKey,

Code about this in my project:
https://github.com/gdh1995/vimium-c/blob/33fbafabfab63a907cce55e26a0670e4e24f2cd0/lib/dom_utils.ts#L353

https://github.com/gdh1995/vimium-c/blob/33fbafabfab63a907cce55e26a0670e4e24f2cd0/lib/dom_utils.ts#L365

@gdh1995
Copy link
Contributor

gdh1995 commented Aug 24, 2018

By the way, I haven't understood changes about lastHoveredElement when a new HoverMode replaces an old. I'll test it on my computer in a few hours - but not now (on China, it's work time~).

@gdh1995
Copy link
Contributor

gdh1995 commented Aug 24, 2018

I've tested on http://jsfiddle.net/wUNhU/81/ , and after I hovered #c1 and then #c2 at once, the result was , mouseenter, mouseover, mouseout, mouseleave, mouseenter, mouseover, mouseout, mouseleave:

image

Explain: The last mouseout (which is wrong) is dispatched when the previous HoverMode exited, but during the mouseover on #c2 Vimium also dispatched a mouseout.

A plain idea: rework HoverMode into:

  • do nothing and exit if any key except Escape
  • dispatch mouseout and exit if a first key is Escape

@cadillion
Copy link

Are there any reasons why this PR hasn't been merged? I'm interested in using the feature set and would love to offer any fixes that may be required.

@gdh1995
Copy link
Contributor

gdh1995 commented Jun 4, 2019

Seems to replace #2881 and solve #2829 and #484.

@horak
Copy link

horak commented Oct 19, 2019

Just bumping @cadillion's comment—is there anything preventing this from merging?

@4fthawaiian
Copy link

any movement on this?

@dacodas
Copy link

dacodas commented Feb 10, 2020

I would love this feature :)

@philc philc merged commit 097c21b into philc:master Feb 21, 2020
@philc
Copy link
Owner

philc commented Feb 21, 2020

Great work @smblott-github! Works great.

This functionality is pretty undiscoverable -- we need a better way to document command parameters (e.g. #2827).

For now I've documented it in our wiki, and will link to this wiki entry in the release notes when this hits the store.

@eyalev
Copy link

eyalev commented Mar 11, 2020

I see the option to copy the link text with action=copy-text

Is there an option to copy the link URL?

@gdh1995
Copy link
Contributor

gdh1995 commented Mar 11, 2020

@eyalev There has been a command named LinkHints.activateModeToCopyLinkUrl for this.

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.

None yet

8 participants