Closed Bug 1602152 Opened 4 years ago Closed 4 years ago

Ignore + and - when copying manually from Changes panel

Categories

(DevTools :: Inspector: Changes, enhancement, P2)

enhancement

Tracking

(firefox74 fixed)

RESOLVED FIXED
Firefox 74
Tracking Status
firefox74 --- fixed

People

(Reporter: victoria, Assigned: rcaliman)

References

Details

Attachments

(1 file)

We've received a good amount of feedback about wanting to ignore the +/- signs when selecting and copying declarations in Changes.

A related feature I think is important for the future is an option to copy the declaration block. However, ignoring +/- seems like a good improvement either way, as it adds flexibility.

This does make the manual copying workflow less useful for sharing a diff, but anyone who wants to do this can use Copy Changes instead.

The downside of this approach is loss of context when pasting the contents elsewhere.

Consider changing the value of a property (old value removed, new value added):

h1 {
- font-weight: 500;
+ font-weight: 900;
}

Becomes:

h1 {
  font-weight: 500;
  font-weight: 900;
}

It gets particularly confusing when just removing a declaration (the context about removal is lost):

h1 {
- font-weight: 500;
}

Becomes:

h1 {
  font-weight: 500;
}

In this reduced example, the intent of the copied content is backwards (addition instead of removal). It's easy to spot in a short list of declarations, but I can imagine it leading to frustrating situations where the removal is unintentionally copied over as an addition and causing confusion.


Perhaps the sustainable solution is to have the separate Copy Declarations option in the context menu (bug 1541815) and/or an option to jump back to the right context in the Rules panel so people may copy the latest state of declarations from there (bug 1505337). Either one of these would satisfy the stated use case while keeping the existing behavior as-is (+/- diff markers included in the clipboard contents).

I agree with :rcaliman on this. We discussed this problem a few times in the past and always came to the same conclusion.

I see that the diff might not be ideal for some people, but our options for text selections are not without problems. Two concerns that I have:

  1. As :rcaliman pointed out, removals would be copied in a useless way. We would need to modify the clipboard contents (e.g. apply commenting or exclude removals), but then it's not clear to the user what they get in the end. Right now, it's very easy: what you highlight is what you get, the same way as with any other application.
  2. Assuming we find a way for 1), we will need to handle partial selections. That will require a lot of assumptions and edge cases.

I think we should look for ways to encourage our other copy options as they produce more predictable results. And we could always extend on the context menu by offering more specific options (e.g. "copy additions"). But for that I'd like us to better understand the use cases first.

Thanks all. To clarify, instead of modifying the clipboard comments, I would suggest making the + and - non-selectable so it would still be clear what you're getting. It would work like a diff on github. In this sense, the + and - act as decoration rather than diff code. This does still lose the context of removals, but I expect users to only copy additions, and it seems easy enough to only copy additions since they're grouped together. Maybe there's a good way to word a question to twitter to clarify the use cases for or against this - I will try tomorrow morning.

I'll file a separate issue about my idea for one-click Copy Declarations.

Findings:

Tweet: "Do you copy and paste directly from the panel instead of using the export buttons? If so, why?"

  • People who copy/paste are copying changes into their code, not copying for other uses like sharing/archiving. They don't use Copy Rule as the amount of info it brings is excessive. Folks like the workflow of being able to copy just parts of their changes to bring back to their CSS. They want a minimal amount of the changes to reduce post-export fiddling. This hints that people aren't generally copying the deletions - they're grabbing a specific number of additions.

Follow up tweet: "We're thinking about preventing the + and - signs from being selected/copied. Would this negatively affect your workflow?"

  • No one said this would negatively affect their workflows. Some folks suggested making it an option. A large number of folks commented excitedly in favor of removing the signs.
Assignee: nobody → rcaliman
Status: NEW → ASSIGNED
Priority: -- → P2

Revert to using CSS pseudo-elements for the +/- diff markers in the Changes panel so they don't get copied over as plain text to the clipboard.

Pushed by rcaliman@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/afb897356584
Make diff markers non-selectable in Changes panel. r=pbro
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 74
See Also: → 1613960
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: