website
website copied to clipboard
Flet accessibility's bug
Flet accessibility section's example doesn't work as excpected when you press "Ctrl" + "S"
I run exactly this example and it's has a weird behaviour
import flet as ft
def main(page: ft.Page):
page.title = "Flet counter example"
page.vertical_alignment = ft.MainAxisAlignment.CENTER
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
def on_keyboard(e: ft.KeyboardEvent):
print(e)
if e.key == "S" and e.ctrl:
page.show_semantics_debugger = not page.show_semantics_debugger
page.update()
page.on_keyboard_event = on_keyboard
txt_number = ft.Text("0", size=40)
def button_click(e):
txt_number.value = str(int(txt_number.value) + 1)
page.update()
page.add(
txt_number,
ft.Text("Press CTRL+S to toggle semantics debugger"),
ft.FloatingActionButton(
icon=ft.icons.ADD, tooltip="Increment number", on_click=button_click
),
)
ft.app(target=main, view=ft.AppView.WEB_BROWSER)
when I click anywhere on the screen after pressing "ctrl" + "s", the mouse pointer show a blue circle.
https://github.com/flet-dev/website/assets/128521274/678467a0-9f9f-4e1e-a6a9-e3d2823c900c
It happens because ctrl+s is "save" on the browser. Change it to shift and it will work.
import flet as ft
def main(page: ft.Page):
page.title = "Semantics Debugger Example"
page.vertical_alignment = ft.MainAxisAlignment.CENTER
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
def on_keyboard(e: ft.KeyboardEvent):
if e.shift and e.key == "S":
page.show_semantics_debugger = not page.show_semantics_debugger
page.update()
page.on_keyboard_event = on_keyboard
def button_click(e: ft.Event[ft.FloatingActionButton]):
counter.value = str(int(counter.value) + 1)
page.update()
page.add(
counter := ft.Text("0", size=40),
ft.Text("Press Shift+S to toggle semantics debugger"),
ft.FloatingActionButton(
icon=ft.Icons.ADD,
tooltip="Increment number",
on_click=button_click,
),
)
ft.run(main, view=ft.AppView.WEB_BROWSER)
(using the v0.80.0)