Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes cell-selection logic in Table.svelte #10646

Merged
merged 10 commits into from
Feb 21, 2025
Merged

Fixes cell-selection logic in Table.svelte #10646

merged 10 commits into from
Feb 21, 2025

Conversation

abidlabs
Copy link
Member

@abidlabs abidlabs commented Feb 21, 2025

Makes a few small fixes to cell-selection logic, see inline comments below:

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Feb 21, 2025

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Storybook ready! Storybook preview
🦄 Changes detecting...

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/179482e343bf0b77edb8357285ccdf8adc7a8e25/gradio-5.17.0-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@179482e343bf0b77edb8357285ccdf8adc7a8e25#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/179482e343bf0b77edb8357285ccdf8adc7a8e25/gradio-client-1.12.0.tgz

Use Lite from this PR

<script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/179482e343bf0b77edb8357285ccdf8adc7a8e25/dist/lite.js""></script>

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Feb 21, 2025

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/dataframe patch
gradio patch
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Fixes cell-selection logic in Table.svelte

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@abidlabs abidlabs added the v: patch A change that requires a patch release label Feb 21, 2025
@@ -1,5 +1,5 @@
---
"gradio": minor
"gradio": patch
Copy link
Member Author

Choose a reason for hiding this comment

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

Unrelated changeset fix

@abidlabs abidlabs changed the title changes Fixes cell-selection logic in Table.svelte Feb 21, 2025
@@ -263,6 +263,7 @@
switch (event.key) {
case "ArrowDown":
selected = [0, selected_header];
selected_cells = [[0, selected_header]];
Copy link
Member Author

Choose a reason for hiding this comment

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

There was an issue where if you were in the topmost row and you pressed the up key, it would keep the topmost cell selected while also selecting the header cell. These arrow-related changes fix that while also allowing you to go "back down" from the header cell to the cell value.

Screen.Recording.2025-02-20.at.10.51.57.PM.mov

Copy link
Collaborator

Choose a reason for hiding this comment

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

thanks for the extra context!

Comment on lines +902 to 922
function handle_header_click(event: MouseEvent, col: number): void {
if (event.target instanceof HTMLAnchorElement) {
return;
}

event.preventDefault();
event.stopPropagation();

if (!editable) return;

clear_on_focus = false;
active_cell_menu = null;
active_header_menu = null;
selected = false;
selected_cells = [];
selected_header = col;
header_edit = col;

parent.focus();
}
</script>
Copy link
Member Author

Choose a reason for hiding this comment

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

At some point, we lost the ability to edit the header of cells.

Copy link
Collaborator

Choose a reason for hiding this comment

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

dang. i guess we didn't have a story for that

Comment on lines +1037 to +1041
<SortIcon
direction={sort_by === i ? sort_direction : null}
on:sort={({ detail }) => handle_sort(i, detail)}
{i18n}
/>
Copy link
Member Author

Choose a reason for hiding this comment

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

Hides the sort icon a when header cell is being edited

@abidlabs
Copy link
Member Author

One change I made was that when you use the arrow keys to navigate, the cell you navigate to is not automatically editable now. This allows you to quickly navigate through many cells using your keyboard:

Screen.Recording.2025-02-20.at.10.56.12.PM.mov

@abidlabs abidlabs marked this pull request as ready for review February 21, 2025 06:56
@hannahblair
Copy link
Collaborator

Screenshot 2025-02-21 at 15 41 26

nooooo

@hannahblair
Copy link
Collaborator

hannahblair commented Feb 21, 2025

One change I made was that when you use the arrow keys to navigate, the cell you navigate to is not automatically editable now. This allows you to quickly navigate through many cells using your keyboard:

this makes sense! feels like a better UX.

Kapture 2025-02-21 at 16 34 43

tested and looks good to me!

@abidlabs
Copy link
Member Author

Thanks @hannahblair! I'll go ahead and merge this in. I believe our plan should restart in a couple of days, right? If not, we can upgrade

@abidlabs abidlabs merged commit b01ce47 into main Feb 21, 2025
23 of 24 checks passed
@abidlabs abidlabs deleted the cell-selection branch February 21, 2025 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v: patch A change that requires a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants