Bug 138722 - Custom shortcut for uno:BackgroundColor should set last color not NoFill
Summary: Custom shortcut for uno:BackgroundColor should set last color not NoFill
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.1.5.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Heiko Tietze
URL:
Whiteboard: target:26.8.0 target:26.2.0.2
Keywords:
: 169262 (view as bug list)
Depends on:
Blocks: Shortcuts-Accelerators
  Show dependency treegraph
 
Reported: 2020-12-07 20:08 UTC by Robert Lacroix
Modified: 2025-12-18 06:07 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Lacroix 2020-12-07 20:08:05 UTC
Description:
Current behaviour - a custom shortcut key bound to Category:{Format}, Function:{Background Color} sets the cell background colour to "No Fill". This is possibly a bug when the current Background Color is something else.

Requested behaviour - successive strokes of the custom shortcut key alternates the cell's Background Color between the current selection of the Background Color tool, and "No Fill".

Another proposal (more complex but more functional) - instead of alternating between the 2 choices above, each keypress chooses the next colour in the list of Recent colours of the Background Color tool. This allows the user to rapidly select from among Recent colours while keeping both hands on the keyboard. When the user tries to go beyond the end of the list, automatically open the Background Color tool. This tool already has a good keyboard interface for selecting another colour (arrows navigate, Enter accepts, "r" jumps to the Recent list, Esc cancels) which gets added to the Recent list. To be most useful, change the Recent list into a Recent history queue, where the most recently used colour is moved to the head of the queue. Since the cell changes colour instantaneously with each keystroke, the move up the queue occurs when a different keystroke or mouse click happens. This would allow the user to repeatedly assign the same colour multiple times with just one keystroke.

Note that either of these proposals is compatible with current functionality when the user has not yet selected a colour.

Steps to Reproduce:
1. Assign a custom shortcut key (for example F3) to Background Color
1a navigate to Tools > Customize
1b choose the Keyboard tab
1c select F3 in the Keystroke list
1d select Format in the Category list
1e select Background Color in the Function list
1f click Modify
1g click OK
2. Pick a colour in the Background Color tool; the active cell changes colour
3. Press F3; the cell Background Color is set to No Fill
4. Select another cell
5. Press F3; nothing happens, the Background Colour is still No Fill

Actual Results:
As noted in steps 3 to 5 in Steps to Reproduce

Expected Results:
If the current operation is considered to be a bug, then pressing F3 should set the cell's Background Colour to the current setting of the Background Color tool. There should have been no change in Step 3 and Step 5 should have set the colour.


Reproducible: Always


User Profile Reset: No


OpenGL enabled: Yes

Additional Info:
Version: 6.1.5.2
Build ID: 1:6.1.5-3+deb10u6
CPU threads: 12; OS: Linux 4.19; UI render: default; VCL: x11; 
Locale: en-CA (en_CA.utf8); Calc: group threaded

If current functionality is NOTABUG, then consider this request to be an enhancement request.
Comment 1 Heiko Tietze 2021-11-15 11:55:12 UTC
The command .uno:BackgroundColor is the widget at the formatting toolbar to set the background color. Clicking this widget applies the last used color (or no fill) to the selected cells, clicking the expander opens the listview.

It's very purposeful to not toggle: imagine you want to set the background of some non-adjacent cells to the same color. So clearly NAB/WF.

Depending on your workflow you might love the cell style feature.
Comment 2 Robert Lacroix 2021-11-15 14:53:58 UTC
OK, I agree and withdraw the request for toggle functionality as a proposed solution.

So then how about just fixing the bug, your way? I expect the custom keystoke to apply the last used background colour, as you stated. The keystroke instead only applies "no fill" regardless of the last used background colour.

Do you expect the custom keystroke to apply the last used background colour that was set at the time the key was bound to the function, or to apply the last used background colour at keypress time (as I expected)? I confirm that neither behaviour works, i.e. the custom keystroke ALWAYS uses "no fill". This is the bug that I raised, which was not addressed in the response.
Comment 3 Heiko Tietze 2021-11-15 15:04:00 UTC
(In reply to Robert Lacroix from comment #2)
> I expect the custom keystroke to apply the last used background colour...

Me too :-)
Comment 4 QA Administrators 2023-11-16 03:12:51 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2025-11-16 03:13:39 UTC Comment hidden (obsolete)
Comment 6 questions2000 2025-12-03 16:44:13 UTC
*** Bug 169262 has been marked as a duplicate of this bug. ***
Comment 7 questions2000 2025-12-03 16:45:48 UTC
@QA Administrators

I see that the reply above is to the OP but this post is from about 5 years ago.  Just in case he does not respond, hope it is alright but I will respond.

The original post for this might be a little confusing because it includes 2 issues.
The toggle request was agreed in the comments above to be not required to be added.
My reply is regarding the `Background Color` shortcut issue.

-----------------------------------------------------------
CURRENT BEHAVIOR
I can confirm that the `Background Color` shortcut action does apply a `No Fill` which removes the background color if one is present, which is an issue.

-----------------------------------------------------------
EXPECTED BEHAVIOR
`Background Color` shortcut action should apply the current color being shown in the `Background Color` toolbar icon.

-----------------------------------------------------------
VERSIONS TESTED
Linux / Debian 12 based (X11)
24.8.4.2 installed deb version

New AppImage Version: 25.8.2.2 (X86_64)
LibreOffice-fresh.basic-x86_64.AppImage

This issue occurs in both of these versions.

-----------------------------------------------------------

Hope this helps.
Thank you to anyone who reads this and to anyone willing to fix this issue.

SOMEWHAT RELATED ISSUE
When testing this out I also had the idea of testing the `Font Color` shortcut as well.  Strange, this has an issue as well.
Made a new issue about about it here if anyone is interested.
https://bugs.documentfoundation.org/show_bug.cgi?id=169812
Comment 8 Commit Notification 2025-12-17 20:20:33 UTC
Heiko Tietze committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/067e78a01ce9a9f4e8056108c640984a3c9dbc33

Resolves tdf#138722 - Apply last used color for uno:BackgroundColor

It will be available in 26.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2025-12-18 06:07:15 UTC
Heiko Tietze committed a patch related to this issue.
It has been pushed to "libreoffice-26-2":

https://git.libreoffice.org/core/commit/bdc4b4cafd092ead7eb5a0fc67d02b9c289f8df7

Resolves tdf#138722 - Apply last used color for uno:BackgroundColor

It will be available in 26.2.0.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.