Hacker News new | ask | show | jobs
by 462436347 711 days ago
Specifically the right-click menu option, which is often greyed out for no apparent reason. This happens on both Windows and Linux. Ctrl+C still works, but how does Firefox break something as basic as the right-click menu and copy in 2024?
5 comments

Because the bug involves sending and receiving messages to multiple other processes. Each webpage you visit is potentially in a different process, and each of those processes maintains its own selection state (that state is visible to javascript running in the page, and you don't want to leak what you copy on this page to any other, so it would be hard to put it anywhere else). There is only one context menu though (in the main process), so it has to send a message to the content process to find out if anything is selected or not. It seems that somehow the message is going to the wrong content process, to a page where nothing is selected. The context menu itself then displays exactly the right thing, based on the data it got back.
I hear what you are saying but the entire architecture is build around IPC message passing. A lot of user interaction will work the same way. There is nothing inherently more difficult about this scenario than many others within Firefox.

If it has such a convoluted code path that it cannot even be debugged then that’s an issue with the architecture, not that the user has a crazy difficult edge case which every other browser seems to manage.

Judging by the comments a lot of people in this thread have been affected by this issue.

It's a caching issue, so it's by definition as tricky and elusive as a sasquatch.

There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors.

> Judging by the comments a lot of people in this thread have been affected by this issue.

I'm sincerely surprised by how many people on Hacker News are apparently copy/pasting with the context menu rather than using Ctrl+C.

PSA for some common keyboard shortcuts:

Alt+Left to navigate back (Alt+Right to navigate forward)

Ctrl+T to open a new tab (Ctrl+Shift+T to reopen previously closed tab)

Ctrl+N to open a new window (Ctrl+Shift+N to reopen previously closed window)

Ctrl+Shift+P to open a new private window

Ctrl+W to close the current tab (Ctrl+Q to close all windows)

Ctrl+R to reload the page (Ctrl+Shift+R to do a forced reload of cached assets)

Ctrl+Plus to zoom in (Ctrl+Minus to zoom out, Ctrl+Zero to reset zoom level)

Ctrl+Tab to focus the next tab in line (Ctrl+Shift+Tab for the previous tab in line)

Alt+One to focus the first tab (Alt+Two for the second tab, etc.)

Ctrl+F to search the text of the page (/ (forward slash) for quick find)

A person selecting text on a webpage is usually using the mouse already. It's reasonable to use the same device to choose the copy command.
Sometimes people gotta jerk, and that leaves only one hand free, which means. Mouse for interaction, Obviously.

But more seriously - FF isn't vim and no I'm not installing vim keybindings. And I do use the keyboard a lot (I've had to teach coworkers the tips for tab navigation for example), when in "type/entry" mode (oh maybe VIM is the right metaphor hmm).

Anyways, sometimes you're just chilling with a few tabs and wanna pop back and forth between a few, and not be in type mode... So mouse it is. And if you're using mouse and hand off the keyboard it's far easier to just use the right click (I've only started doing this the past year or two... likewise I've taken to right click, back from the popup menu instead of dragging mouse across to the back arrow. (but if on keyboard yeah I alt-arrow it).

What i love is how everyone just demands everyone use the interface the exact same way for all purposes and times.

I do get frustrated at my roomie who won't just do it my way, when I ask her to search for something or I'm trying to help with something technical and she's in control of her laptop... though, and in those times I'm 100% right and legit. That's the only exception to my paragraph above.

> maintains its own selection state

This is the real bug. Why is it not global?

Probably related to how if you go to google, leave the browser for terminal or ide, you still get a google hover text that brands everything else on your desktop depending on where your mouse was when you left the browser.

For one thing, the selection state is visible to the webpage. For another thing, the webpage is where the text lives. Put that way it sounds funny, but think about it. You have a bunch of content processes, each of which is in charge of loading some number of webpages that the user wants to have open. There is a single UI process that the user can interact with. When the user actually initiates a copy, the UI process doesn’t know what text to put into the clipboard. The text is all in the content process! The UI process merely has to figure out which content process to send the messages to, so that the right text ends up in the clipboard. And that's more complicated than it looks because any given page you are looking at might be stored in multiple processes. A page on domain A with a frame that has content from domain B will often have a different content process for both domains, to ensure maximum separation of state between them.

The bug appears to be a race condition in how the state of which content process has the most recent selection is synchronized with the UI process. The patch at the end of the bug report changes it so that when the user unloads a page no message is sent to delete that state. Instead, only whatever page gets loaded or switched to next will send a message to replace the state. This should eliminate the problem.

Left–over tooltips are a completely different kind of problem.

I have been affected by this one on my Ubuntu desktop for months. It is very annoying! Ctrl+C also works for me, but I am so used to right clicking it really throws me off.
This has been driving me crazy on both Windows and Linux as you say.
This has been happening to me on MacOS as well
The website you are visiting might be breaking it. There are many sites which will force that option to grey out upon right-click.

This is by design.

> The website you are visiting might be breaking it. There are many sites which will force that option to grey out upon right-click.

No, this is a new thing that happens on sites that weren't and aren't doing that. Also tab-switching fixes it.

I'm pretty sure that merely tab-switching hasn't fixed it for me. I've done both mouse and alt-tab, i've ctrl-w'd the tab and ctrl-shift-T'd it. I've opened the same site in a new tab and it still wouldn't work. I've had to completely shut the browser down. Maybe it's different between Windows and Linux, perhaps (I'm using Windows for this).

Maybe there's more than one cause, but the reason I hate this bug so much is because simple fixes like just alt-tabbing or even closing and re-opening or full-reload doesn't work. I'm like 99% certain that's the case. I'll have to verify next time this happens. It seems to happen at least a couple times a month.

Clicking the URL bar once always fixes it for me.
Many websites will also prevent highlighting text as well. Reader mode is helpful for that.
Or just hold down shift, at least in Firefox. This avoids sending the events to the javascript on the page so that the user can act on the page without being blocked, while still using a page’s own context menu if it really does provide a useful one (Google Docs, for example, has one with actual editing actions in it).
It's the duty and responsibility of a properly implemented browser to not allow a "website" to break basic UI functionality because it pushes some javascript. I don't care about how Safari and chrome and edge do it. Firefox should not follow their lead.

This is a fine example of why people install plugins like ublock origin and similar.

Firefox does it best here, because you can hold shift to get the original context menu back when the page blocks it or provides their own.
Exactly. There are legitimate use cases for hijacking the right-click menu to make it better. For example, Google docs, GMail, etc. The best solution IMHO is the shift key to get the normal menu. It's the best of both worlds.