Clicking the Header makes it tall, but `Header.tall` stays False
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
The header widget lives in src/textual/widgets/_header.py; read _on_click there next to watch_tall, which is what actually applies the -tall class when the reactive changes. Run the snippet from the issue against a checkout to confirm the mismatch, then check the existing header tests (and snapshot tests under tests/) for where to add a regression case. Done means a click sets tall to True and header.tall = False shrinks the header back to one line. Note the reporter says a PR with a test is already prepared, so coordinate before starting.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi! I hit this while writing generated tests against Textual's widgets.
Header._on_click toggles the -tall class directly, rather than the tall reactive that watch_tall uses to set that class. So after a click the header is drawn tall but tall is still False, and header.tall = False does nothing, because the value hasn't changed.
import asyncio
import textual
from textual.app import App, ComposeResult
from textual.widgets import Header
class HeaderApp(App):
def compose(self) -> ComposeResult:
yield Header()
async def main() -> None:
app = HeaderApp()
async with app.run_test() as pilot:
header = app.query_one(Header)
await pilot.pause()
print(f"start: tall={header.tall} height={header.size.height} classes={sorted(header.classes)}")
await pilot.click(offset=(40, 0)) # on the title
await pilot.pause()
print(f"after click: tall={header.tall} height={header.size.height} classes={sorted(header.classes)}")
header.tall = False
await pilot.pause()
print(f"after tall = False: tall={header.tall} height={header.size.height} classes={sorted(header.classes)}")
print("Textual", textual.__version__)
asyncio.run(main())
Output on Textual 8.2.7 (and the same on main at 5e5b7ef):
start: tall=False height=1 classes=[]
after click: tall=False height=3 classes=['-tall']
after tall = False: tall=False height=3 classes=['-tall']
I expected tall=True after the click, and the header to go back to one line after header.tall = False. Toggling the reactive in _on_click (self.tall = not self.tall) gives that, and I have a PR with a test ready if you'd like it.
- Ngôn ngữ chính
- Python
- Star
- 37.7k
- Fork
- 1.5k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc 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 Textualize/textual
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Textualize/textual#6790 · 2 bình luận ·
-
Markdown table of contents: the node added for a skipped heading level shows the wrong numeralĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Textualize/textual#6789 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Textualize/textual#6787 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Textualize/textual#6782 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Textualize/textual#6778 · 1 bình luận ·
Tất cả issue của Textualize/textual
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
mohanraj00/entelos#200 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Dead url in mise.tomlĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
-
sweep
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
bketelsen/truenas-mcp#77 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Console writes URL credentials to the local log, though AGENTS.md says secrets never reach diskĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
sandbox-quantum/switch#2163 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
openedx/xblock-lti-consumer#765 ·
Maintainer thường phản hồi trong vòng 1 ngày