unable to copy jsx on https://heroicons.com/

For support with specific websites

Moderator: trava90

Forum rules
Please always mention the name/domain of the website in question in your topic title.
Please one website per topic thread (to help keep things organized). While behavior on different sites might at first glance seem similar, they are not necessarily caused by the same.

Please try to include any relevant output from the Toolkit Error Console or the Developer Tools Web Console using the following procedure:
  1. Clear any current output
  2. Navigate or refresh the page in question
  3. Copy and paste Errors or seemingly relevant Warnings into a single [ code ] block.
User avatar
srkrishnan
New to the forum
New to the forum
Posts: 1
Joined: 2023-07-14, 05:41

unable to copy jsx on https://heroicons.com/

Unread post by srkrishnan » 2023-07-14, 06:03

hello,

1). To reproduce problem open https://heroicons.com/
2). search for icon
3). mouse hover icon ,click jsx button

able to copy on other browser
You do not have the required permissions to view the files attached to this post.

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2194
Joined: 2018-05-05, 13:29

Re: unable to copy jsx on https://heroicons.com/

Unread post by vannilla » 2023-07-14, 07:52

Wrong subforum, but anyway:

Code: Select all

TypeError: navigator.clipboard is undefined

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35650
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: unable to copy jsx on https://heroicons.com/

Unread post by Moonchild » 2023-07-14, 08:34

Off-topic:
vannilla wrote:
2023-07-14, 07:52
Wrong subforum
moved.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35650
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: unable to copy jsx on https://heroicons.com/

Unread post by Moonchild » 2023-07-14, 08:40

We do not allow access to the clipboard data for security reasons. As such we do not implement navigator.clipboard, only methods of the API to set clipboard contents. I do not see why this website would want to read the clipboard for the intended function (which is what navigator.clipboard allows. It's a read-only property to get data out of the clipboard, not copy stuff to it) so that's a little suspect.

The risk here should be obvious: any open website would be able to monitor the system clipboard by polling this property and steal your data. This would require strict permission control on a per-site basis which would still not be desirable (in case of sites getting compromised, etc.). Allowing access to clipboard data from remote content is simply not safe.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Enobarbous
Moonbather
Moonbather
Posts: 50
Joined: 2022-12-06, 17:44

Re: unable to copy jsx on https://heroicons.com/

Unread post by Enobarbous » 2023-07-16, 12:34

Moonchild wrote:
2023-07-14, 08:40
I do not see why this website would want to read the clipboard for the intended function (which is what navigator.clipboard allows. It's a read-only property to get data out of the clipboard, not copy stuff to it) so that's a little suspect.
They use navigator.clipboard.writeText() to write the svg to the clipboard
As far as I see in mdn, in firefox the use of "write" and "writeText" is allowed, and "read" is disabled behind the pref. It might be worth doing the same? Or just always return an empty object, regardless of the actual contents of the clipboard.
And add a query to Permissions...
I am sorry for the use of auto-translator to post

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35650
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: unable to copy jsx on https://heroicons.com/

Unread post by Moonchild » 2023-07-16, 12:57

You don't seem to understand. We do not implement navigator.clipboard at all at this point.

Copying data to the clipboard is done with document.execCommand("copy").
If you put the execCommand() call inside a click event handler, you don't need any special permissions (script-initiated would need permissions for security reasons - it has to be a user interaction to initiate it (without delay); we simply deny this kind of request and throw an error).

For more information see also https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard
Note the remark at the top about navigator.clipboard not being implemented in all browsers because it's a recent addition to the spec for web interaction.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Enobarbous
Moonbather
Moonbather
Posts: 50
Joined: 2022-12-06, 17:44

Re: unable to copy jsx on https://heroicons.com/

Unread post by Enobarbous » 2023-07-16, 14:18

Moonchild wrote:
2023-07-16, 12:57
You don't seem to understand. ... Note the remark at the top about navigator.clipboard not being implemented in all browsers because it's a recent addition to the spec for web interaction.
I understand all of that. But well, it's the new fancy api (tm) and it's not the first site to use it. Sooner or later something will have to be done about it.
Plus, it's been partially implemented since ff63, that is just under 5 years now. It's not that "new".
I am sorry for the use of auto-translator to post

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35650
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: unable to copy jsx on https://heroicons.com/

Unread post by Moonchild » 2023-07-16, 14:32

Yeah and we're not the ones coming up with new shinies every week.
I'm sure sooner or later it will be implemented. But it doesn't have priority right now. We have bigger fish to fry.
As long as usage is still low, it will be on the back-burner out of necessity. We have to work reactive in most cases, as in implement APIs when they are actually in use at some scale. See also the header "Core work" on https://www.palemoon.org/roadmap.shtml
However, if it is important to people, everyone is welcome to chip in and help implement it into UXP. Adding another DOM interface should not be overly complex even for someone relatively new to our code, with the guidance of the relevant implementation bug on Mozilla's bugtracker.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

SemiKebab
Moonbather
Moonbather
Posts: 50
Joined: 2021-05-30, 03:48

Re: unable to copy jsx on https://heroicons.com/

Unread post by SemiKebab » 2023-11-08, 23:14

I also would be grateful to see navigator.clipboard implemented. Probably just the writeText() method, as write() seems less useful, and I really don't feel confident with the read methods…

A few years ago, I was quite reluctant with JS clipboard write ("what if I had something important in the clipboard?"), but I have to admit I got really used to this feature. More and more sites use it, to copy emojis, temp email addresses, anchor links…

Note that clipboard write could already be achieved previously, but it was much more complicated, whereas it can now be a one-liner (and it's async, which is probably justified).

Some refs:
Last edited by SemiKebab on 2023-11-09, 07:32, edited 1 time in total.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35650
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: unable to copy jsx on https://heroicons.com/

Unread post by Moonchild » 2023-11-09, 02:57

It's on our radar.
Issue #2361 (UXP)
If you want to help out with a pull request, it'd be greatly welcomed!
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

SemiKebab
Moonbather
Moonbather
Posts: 50
Joined: 2021-05-30, 03:48

Re: unable to copy jsx on https://heroicons.com/

Unread post by SemiKebab » 2024-01-13, 18:07

The feature has been implemented into UXP in November 2023 (BTW, thanks!), though, why is it still not present in Pale Moon?

User avatar
RealityRipple
Astronaut
Astronaut
Posts: 666
Joined: 2018-05-17, 02:34
Location: Los Berros Canyon, California

Re: unable to copy jsx on https://heroicons.com/

Unread post by RealityRipple » 2024-01-13, 19:46

SemiKebab wrote:
2024-01-13, 18:07
The feature has been implemented into UXP in November 2023 (BTW, thanks!), though, why is it still not present in Pale Moon?
See viewtopic.php?f=62&t=30568

Personally, I think the spec is a major privacy and security problem (as my shot-down "dummy" option attests to).

SemiKebab
Moonbather
Moonbather
Posts: 50
Joined: 2021-05-30, 03:48

Re: unable to copy jsx on https://heroicons.com/

Unread post by SemiKebab » 2024-01-13, 19:56

That post seems to be (mainly) about read access for extensions.

I was thinking about write access for web content, which is the most basic (and also probably the most used) functionnality. I thought we all agreed it was ok to implement it?

User avatar
RealityRipple
Astronaut
Astronaut
Posts: 666
Joined: 2018-05-17, 02:34
Location: Los Berros Canyon, California

Re: unable to copy jsx on https://heroicons.com/

Unread post by RealityRipple » 2024-01-13, 20:03

Final implementation of one requires final decision on the other. I think you can temporarily enable it through about:config, though.

User avatar
Nigaikaze
Board Warrior
Board Warrior
Posts: 1322
Joined: 2014-02-02, 22:15
Location: Chicagoland

Re: unable to copy jsx on https://heroicons.com/

Unread post by Nigaikaze » 2024-01-13, 20:16

SemiKebab wrote:
2024-01-13, 18:07
The feature has been implemented into UXP in November 2023 (BTW, thanks!), though, why is it still not present in Pale Moon?
It is currently scheduled to be included in the upcoming release of Pale Moon 33.0.0.
Nichi nichi kore ko jitsu = Every day is a good day.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35650
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: unable to copy jsx on https://heroicons.com/

Unread post by Moonchild » 2024-01-14, 00:47

SemiKebab wrote:
2024-01-13, 18:07
The feature has been implemented into UXP in November 2023 (BTW, thanks!), though, why is it still not present in Pale Moon?
This is how development works when you're not shoving nightly/alpha/untested builds of software out to everyone. Changes will be released when development releases are ready. In this case it'll be the next milestone.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite