Skip to content

bug: on_tap_outside_bar from SearchBar not working #6593

@ranoliveira1

Description

@ranoliveira1

Duplicate Check

Describe the bug

When you click outside the SearchBar nothing happens.

Code sample

Code
import flet as ft

@ft.control
class CustomizedSearchBar(ft.SearchBar):
    def init(self):
        self.controls = [
                ft.ListTile(title="Option 1", on_click=lambda _: print("Option 1")),
                ft.ListTile(title="Option 2", on_click=lambda _: print("Option 2")),
                ft.ListTile(title="Option 3", on_click=lambda _: print("Option 3")),
            ]
        
        self.on_tap = self.handle_ontap
        self.on_tap_outside_bar = self.handle_tap_outside

    
    async def handle_ontap(self, e):
        await self.open_view()
    
    def handle_tap_outside(self, e):
        print('Tapped outside')
    

@ft.component
def App():
    
    return CustomizedSearchBar()


ft.run(lambda page: page.render(App))

To reproduce

Run the code

Expected behavior

print 'Tapped outside'

Screenshots / Videos

Captures

[Upload media here]

Operating System

Windows

Operating system details

11 Pro

Flet version

0.85.3

Regression

No, it isn't

Suggestions

No response

Logs

Logs
[Paste your logs here]

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions