Bug 481967 - Activating Calculator with a global shortcut fails to pass focus to it (only works when clicking on it to activate it)
Summary: Activating Calculator with a global shortcut fails to pass focus to it (only ...
Status: RESOLVED FIXED
Alias: None
Product: kdeplasma-addons
Classification: Plasma
Component: calculator (show other bugs)
Version: 6.0.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: accessibility, usability
Depends on:
Blocks:
 
Reported: 2024-02-28 21:35 UTC by Alex Parker
Modified: 2024-03-06 14:52 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Parker 2024-02-28 21:35:25 UTC
SUMMARY
Is there any way to input data in calculator widget where i opened it with hotkey? Maybe some setting or hack? Please, add this to feature list.

STEPS TO REPRODUCE
1. Link opening calculator widget with hotkey (Meta+K, for example)
2. Press hotkey, calculator widget is opened
3. Try to press digits or other keys — no reaction from widget — cause no focus on widget by default

OBSERVED RESULT
When user presses hotkey to open widget, all next keypresses ignored by calculator. Only if click on opened widget — user can start to input data. 

EXPECTED RESULT
User presses hotkey to open calc widget and start to input digits and operands — no need to click on opened widget second time to activate it's focus.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kde Neon Latest
KDE Plasma Version: 6
KDE Frameworks Version: 6
Qt Version: 6

ADDITIONAL INFORMATION
When I click on the widget icon on the panel, I can immediately enter numbers into the calculator. I think that opening a widget using a hotkey should follow a similar way. I noticed that many widgets got auto-focus when activated via hotkey, AppMenu for example.
Comment 1 Nate Graham 2024-03-01 18:41:13 UTC
In general widgets do this, but it has to be implemented on a per-widget basis. I had thought we fixed this for the Calculator widget with Bug 479642 though. I'll have to investigate.
Comment 2 Nate Graham 2024-03-01 20:04:59 UTC
Ah, it looks like we only fixed it for when the Calculator is clicked on, not when it's activated with a keyboard shortcut. Strange that those have different codepaths.
Comment 3 Alex Parker 2024-03-03 19:45:52 UTC
(In reply to Nate Graham from comment #2)
> Ah, it looks like we only fixed it for when the Calculator is clicked on,
> not when it's activated with a keyboard shortcut. Strange that those have
> different codepaths.

Thank you for widget, Nate. Using it every day.

Before this feature would be released, if somebody has same trouble — I've found temporary workaround.
After activating calculator widget with hotkey, user can simply press Tab key — so widget getting focus on "C" button, and user can input any data. So, in my case, I use combo "Win+K, Tab" and widget works as I'm expecting.
Comment 4 Akseli Lahtinen 2024-03-04 16:14:43 UTC
For some reason it seems that when using keyboard shortcut, `Keys.onPressed` wont listen any input.
Comment 5 Akseli Lahtinen 2024-03-05 11:31:48 UTC
This is getting more weird.

The part with `displayFrame.focus: { focus: main.expanded }`

- If I press with mouse, main expanded true, focus is then set true
- If I press with shortcut, main expanded true, but focus stays false.
Comment 6 Bug Janitor Service 2024-03-05 13:15:40 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/libplasma/-/merge_requests/1072
Comment 7 Marco Martin 2024-03-06 09:32:55 UTC
Git commit 988161d805526a527bf96a94af066757774c552b by Marco Martin.
Committed on 06/03/2024 at 09:19.
Pushed by mart into branch 'master'.

Remove old focus workaround

There was a workaround for an old bug (372476) that fixed the focus
to the FullRepresentation item, but some applets wanted focus not on
the root fullrepresentation item but on some descendant.

For instance it breaks the calculator plasmoid keyboard input.
Reverting that workaround on Plasma6 the original bug doesn't happen
anymore.

M  +0    -9    src/plasmaquick/plasmoid/plasmoiditem.cpp

https://invent.kde.org/plasma/libplasma/-/commit/988161d805526a527bf96a94af066757774c552b
Comment 8 Marco Martin 2024-03-06 09:35:19 UTC
Git commit 800ab725a6e72621ca81e0952d951b5a5ed1061a by Marco Martin.
Committed on 06/03/2024 at 09:35.
Pushed by mart into branch 'Plasma/6.0'.

Remove old focus workaround

There was a workaround for an old bug (372476) that fixed the focus
to the FullRepresentation item, but some applets wanted focus not on
the root fullrepresentation item but on some descendant.

For instance it breaks the calculator plasmoid keyboard input.
Reverting that workaround on Plasma6 the original bug doesn't happen
anymore.

M  +0    -8    src/plasmaquick/plasmoid/plasmoiditem.cpp

https://invent.kde.org/plasma/libplasma/-/commit/800ab725a6e72621ca81e0952d951b5a5ed1061a