black7375 / Firefox-UI-Fix

🦊 I respect proton UI and aim to improve it.
Mozilla Public License 2.0
5.24k stars 184 forks source link

Related to Background Image #773

Closed thunderstone135 closed 9 months ago

thunderstone135 commented 9 months ago

Is your feature request related to a problem?

Hi, I just want to ask if it is possible to remove the context menu items below πŸ‘‡

When browsing the following pages πŸ‘‡

The solution I'd like

I was actually able to remove Open Image in New Tab and Copy Image Link with this πŸ‘‡

#context-copyimage, #context-viewimage {
  display: none !important;
}

However, I didn't want these context menu items removed on all websites. Just on about:blank, about:home, about:newtab, and about:privatebrowsing. So, I tried it with this πŸ‘‡

@-moz-document url-prefix("about:blank"), url-prefix("about:home"),
url-prefix("about:newtab"), url-prefix("about:privatebrowsing") {
  #context-copyimage, #context-viewimage {
    display: none !important;
  }
}

I tried it on userChrome and userContent. It doesn't work. I researched the issue and found that it can be done through JavaScript. I checked if it was possible with userscript. It wasn't. The only URL Patterns supported are http, https, file, ftp, ws, wss, data, and (chrome-) extension. Another method came to mind, but it was too complicated so I'm not going to mention it here.

Putting that aside, some might wonder why I wanted those two context menu items removed. You see, before I enabled userContent.newTab.background_image, those items were not present. Those items would probably not bother some people, but it does bother me. I'm probably just OCD.

With that said, I posted here just in case I missed something that can be done in CSS.

Screenshots or video

N/A

Alternatives I've considered

N/A

Additional context

N/A

black7375 commented 9 months ago

Yeah, it's actually impossible only CSS. However, you can use pointer-events: none for userContent's image elements to make them unrecognized.

thunderstone135 commented 9 months ago

I tried pointer-event, but it didn't work. It is still showing Open Image in New Tab and Copy Image Link.

black7375 commented 9 months ago

I don't know what you did, but you have to apply it to the image.

For example, to prevent the context menu button from running on the logo on a new tab.

image

.logo {
  pointer-events: none;
}
thunderstone135 commented 9 months ago

I was actually talking about the background-image associated with this πŸ‘‡ https://github.com/black7375/Firefox-UI-Fix/blob/6d2cfe210ef3208c56aaf94aeffa569fdb0c1701/css/leptonContent.css#L493-L509 I can't seem to remove the context menu items that appeared after I enabled userContent.newTab.background_image.

thunderstone135 commented 9 months ago

I probably should have added a screenshot in the first post πŸ‘‡

Imgur

black7375 commented 9 months ago

I got it. It's an unintended change of behavior, so I want to solve it, but CSS alone is quite tricky.

thunderstone135 commented 9 months ago

I know, right? I'm still researching if there's a way to hide those context menu items without resorting to JavaScript.

The only success I had so far is adding this on userChrome.css πŸ‘‡

#context-copyimage, #context-viewimage {
  display: none !important;
}

The only caveat is it disables Open Image in New Tab and Copy Image Link everywhere.

black7375 commented 9 months ago

I'm sure @2641a40fd44383320adde4b027a1d0b03bd550 's amazing work has solved this bug. Thanks!!

thunderstone135 commented 9 months ago

Nicely doneπŸ‘