[BUG] `dcc.RangeSlider` ignores `allowCross=False` and lets handles cross
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Bắt đầu từ phần triển khai dcc.RangeSlider và tái hiện ví dụ tối thiểu với allowCross=False. Theo dõi các tương tác bằng con trỏ, bàn phím, Home/End và nhập trực tiếp trong cả hai updatemodes, sau đó tìm hoặc bổ sung coverage cho từng đường đi. Hoàn tất khi các nút điều khiển không thể vượt qua nhau và ví dụ báo [15, 15] cho cả value và drag_value.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Context
dash 4.4.1 (editable source checkout)
- Reproduced at commit:
3d3a9f70f452fba4dc385db94590009ce44031fc - OS: Ubuntu 24.04.4 LTS
- Browser: Google Chrome 151.0.7922.71
The bug
dcc.RangeSlider does not enforce allowCross=False. When the lower thumb is
dragged past the upper thumb, the dragged thumb crosses it and becomes the new
upper thumb.
For example, a slider starting at [5, 15] ends at [15, 18] after its lower
thumb is dragged toward 18. The returned array is still sorted, but the thumb
identity and resulting interval prove that crossing occurred despite being
explicitly disabled. Application callbacks therefore cannot rely on the
allowCross=False constraint.
Minimal reproducible example
from dash import Dash, Input, Output, dcc, html
app = Dash(__name__)
app.layout = html.Div(
style={"margin": "80px auto", "width": "500px"},
children=[
dcc.RangeSlider(
id="range-slider",
min=0,
max=20,
step=1,
value=[5, 15],
allowCross=False,
updatemode="drag",
tooltip={"always_visible": True},
),
html.Pre(id="range-output", style={"marginTop": "40px"}),
],
)
@app.callback(
Output("range-output", "children"),
Input("range-slider", "value"),
Input("range-slider", "drag_value"),
)
def show_values(value, drag_value):
return f"value={value}\ndrag_value={drag_value}"
if __name__ == "__main__":
app.run()
Steps to reproduce
- Run the example and open http://127.0.0.1:8050.
- Drag the lower handle from
5past the upper handle at15, toward18. - Observe that the dragged thumb passes the other thumb and the callback
reportsvalue=[15, 18]anddrag_value=[15, 18].
Expected behavior
With allowCross=False, a handle should stop when it reaches its neighboring
handle. In the example above, dragging the lower handle toward 18 should
clamp both handles at 15, producing:
value=[15, 15]
drag_value=[15, 15]
The same no-cross constraint should apply to pointer, keyboard, Home/End, and
direct-input interactions, with both updatemode="drag" and
updatemode="mouseup".
Screenshots
The bug at commit 3d3a9f70f;
- Ngôn ngữ chính
- Python
- Star
- 24.4k
- Fork
- 2.3k
- Merge trung bình
- 1 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 19
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của plotly/dash
-
good first issue P3 size: 1 task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
enhancement P2 size: 5
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
-
enhancement P3 size: 10+
-
P2 size: 1 task
-
enhancement P3 size: 1
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
Issue tương tự
-
essnmx good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
-
[Feature] 奇物选择添加优先级 Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
syfoud/Simulated_Scepter#174 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Giskard-AI/giskard-oss#2840 · 1 bình luận ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Đang mởarea: repo bug perceived difficulty: 2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
yeti-platform/yeti#1380 ·