Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Sorting while filtering creates incorrect cell highlights #11575

@sfc-gh-dmatthews

Description

@sfc-gh-dmatthews

Checklist

  • I have searched the existing issues for similar issues.
  • I added a very descriptive title to this issue.
  • I have provided sufficient information below to help reproduce this issue.

Summary

If you use filtering to highlight cells, then sort a column without closing the filter, the former positions of the highlighted (filtered) cells remain highlighted. If you sequentially navigate the highlight cells, they remain in their incorrect positions. You have to update the filter to change the highlight positions to match the new sort order.

2025-06-09_17-52-28.mp4

Reproducible Code Example

import streamlit as st
import pandas as pd

df = pd.DataFrame({
    "A": ["foo","foo","foo","bar","bar","bar", "baz", "baz", "baz"],
    "B": ["one","one","two","two","one","one", "two", "two", "one"]
})
st.dataframe(df)

Steps To Reproduce

Open in Streamlit Cloud

  1. Run the app
  2. Use the dataframe filter to search for "foo"
  3. Leave the filter open and click the column header to sort and move the "foo" cells.
  4. Click the step buttons in the filter.

You will remain stuck within the former positions of the "foo" cells (until you update the string filter).

Expected Behavior

No response

Current Behavior

No response

Is this a regression?

  • Yes, this used to work in a previous version.

Debug info

  • Streamlit version: 1.45.1
  • Python version: 3.13
  • Operating System: Mac
  • Browser: Prisma

Additional Information

No response

Metadata

Metadata

Labels

feature:st.dataframeRelated to the `st.dataframe` elementpriority:P3Medium prioritystatus:confirmedBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expected

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions