Skip to content

Conversation

@Light2Dark
Copy link
Contributor

@Light2Dark Light2Dark commented Jul 7, 2025

📝 Summary

CleanShot.2025-07-08.at.10.58.04.mp4

🔍 Description of Changes

  • Allow select on individual cells but clears the selection when multiple cells are selected

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • I have added tests for the changes made.
  • I have run the code and verified that it works as expected.

📜 Reviewers

@vercel
Copy link

vercel bot commented Jul 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marimo-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 8, 2025 3:09am

@Light2Dark Light2Dark marked this pull request as ready for review July 7, 2025 18:06
@mscolnick
Copy link
Contributor

i think this is a lesser of two-evils option for now.

something we can consider is if the current drag selects more than 1 cells (i.e. once its more than 1), clear the selection:

// from https://stackoverflow.com/questions/3169786/clear-text-selection-with-javascript
if (window.getSelection) {
  if (window.getSelection().empty) {  // Chrome
    window.getSelection().empty();
  } else if (window.getSelection().removeAllRanges) {  // Firefox
    window.getSelection().removeAllRanges();
  }
}

@Light2Dark
Copy link
Contributor Author

Thanks, I added the atom to check the state and func to clear the selection. I think its a good middle ground (perf and UX)

const isSelectingMultipleCells = useAtomValue(isSelectingMultipleCellsAtom);

if (isSelectingMultipleCells && window.getSelection) {
window.getSelection()?.empty();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we put this in the reducer? this may mean if you select somewhere else in the page and this re-renders for whatever reason, then the selection is cleared.

it would be better to do this in the reducer once we select more.

this could be in each action, or you can potentially use the reducer middleware

Copy link
Contributor Author

@Light2Dark Light2Dark Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's awesome, didn't think it would be possible, but since the window is global, it makes sense.

@Light2Dark Light2Dark merged commit 362a7e7 into main Jul 8, 2025
25 checks passed
@Light2Dark Light2Dark deleted the sham/enable-select-cell branch July 8, 2025 03:21
@Light2Dark Light2Dark mentioned this pull request Jul 8, 2025
1 task
@github-actions
Copy link

github-actions bot commented Jul 8, 2025

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.14.11-dev23

@manzt manzt added the enhancement New feature or request label Jul 8, 2025
sebbeutler pushed a commit to sebbeutler/marimo that referenced this pull request Jul 16, 2025
## 📝 Summary

<!--
Provide a concise summary of what this pull request is addressing.

If this PR fixes any issues, list them here by number (e.g., Fixes
marimo-team#123).
-->


https://github.com/user-attachments/assets/92337c8d-1250-4bc1-92b4-e3291f3fae5b

## 🔍 Description of Changes

<!--
Detail the specific changes made in this pull request. Explain the
problem addressed and how it was resolved. If applicable, provide before
and after comparisons, screenshots, or any relevant details to help
reviewers understand the changes easily.
-->

## 📋 Checklist

- [x] I have read the [contributor
guidelines](https://github.com/marimo-team/marimo/blob/main/CONTRIBUTING.md).
- [ ] For large changes, or changes that affect the public API: this
change was discussed or approved through an issue, on
[Discord](https://marimo.io/discord?ref=pr), or the community
[discussions](https://github.com/marimo-team/marimo/discussions) (Please
provide a link if applicable).
- [ ] I have added tests for the changes made.
- [ ] I have run the code and verified that it works as expected.

## 📜 Reviewers

<!--
Tag potential reviewers from the community or maintainers who might be
interested in reviewing this pull request.

Your PR will be reviewed more quickly if you can figure out the right
person to tag with @

@mscolnick (General, AI)
@dmadisetti (Runtime, Caching, Fileformat, AST)
@manzt (Widgets, Dependency Management, LSP)
@Light2Dark (Tables, Plots, Layouts, SQL)
@akshayka (Public API, Dependencies, UX/Styling, Backend, Docs,
Integrations)
 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants