toga icon indicating copy to clipboard operation
toga copied to clipboard

Enable keyboard `on_activate` in Table and Tree

Open bruno-rino opened this issue 3 months ago • 4 comments

Pressing the Return key on a table or tree should be semantically identical to double clicking. This PR aims to do that, by invoking on_activate, just like double clicking does.

On GTK, this is the default behaviour, so nothing to do there.

There's a small snag when multiple_select is enabled. Currently, on_activate has an argument: the row/node that was double clicked. When pressing Return when multiple rows are selected, there isn't a single row that should be activated. I chose to not invoke the event in this case.

I placed the code that helps handling this on the core widgets: the _selection_single method. This way it can be shared across implementations.

PR Checklist:

  • [ ] All new features have been tested
  • [x] All new features have been documented
  • [x] I have read the CONTRIBUTING.md file
  • [x] I will abide by the code of conduct

bruno-rino avatar Sep 26 '25 18:09 bruno-rino

Winforms failure is unrelated. c.f. the latest run on https://github.com/beeware/toga/pull/3769

johnzhou721 avatar Sep 26 '25 19:09 johnzhou721

I've restarted CI; if it passes and you think the PR is ready for review, please post a comment.

mhsmith avatar Sep 29 '25 21:09 mhsmith

I think this PR is ready for review.

bruno-rino avatar Oct 05 '25 09:10 bruno-rino

I'm currently preparing a demo for Wednesday, so I may not get a chance to look at this until Thursday.

mhsmith avatar Oct 06 '25 11:10 mhsmith