We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`Switch` should stop the `Click` event from bubbling
At the moment `Switch` handles `Click` but then lets it bubble; there's no good reason to do that and it also stops the ability to write something like this:

```python
from textual.app        import App, ComposeResult
from textual.containers import Horizontal
from textual.widgets    import Header, Footer, Label, Switch

class LabeledSwitch( Horizontal ):

    def on_click( self ) -> None:
        self.query_one(Switch).toggle()

class ClickableLabelApp( App[ None ] ):

    def compose( self ) -> ComposeResult:
        yield Header()
        with LabeledSwitch():
            yield Label( "Click me!" )
            yield Switch()
        yield Footer()

if __name__ == "__main__":
    ClickableLabelApp().run()
```

where the idea is to make a compound widget that lets you click on the `Label` or the `Switch` and the `Switch` will toggle -- only it doesn't work if you click on the `Switch` because it ends up double-toggling.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/textual/widgets/_switch.py`
Content:
```
1 from __future__ import annotations
2 
3 from typing import TYPE_CHECKING, ClassVar
4 
5 from rich.console import RenderableType
6 
7 from ..binding import Binding, BindingType
8 from ..events import Click
9 from ..geometry import Size
10 from ..message import Message
11 from ..reactive import reactive
12 from ..scrollbar import ScrollBarRender
13 from ..widget import Widget
14 
15 if TYPE_CHECKING:
16     from typing_extensions import Self
17 
18 
19 class Switch(Widget, can_focus=True):
20     """A switch widget that represents a boolean value.
21 
22     Can be toggled by clicking on it or through its [bindings][textual.widgets.Switch.BINDINGS].
23 
24     The switch widget also contains [component classes][textual.widgets.Switch.COMPONENT_CLASSES]
25     that enable more customization.
26     """
27 
28     BINDINGS: ClassVar[list[BindingType]] = [
29         Binding("enter,space", "toggle", "Toggle", show=False),
30     ]
31     """
32     | Key(s) | Description |
33     | :- | :- |
34     | enter,space | Toggle the switch state. |
35     """
36 
37     COMPONENT_CLASSES: ClassVar[set[str]] = {
38         "switch--slider",
39     }
40     """
41     | Class | Description |
42     | :- | :- |
43     | `switch--slider` | Targets the slider of the switch. |
44     """
45 
46     DEFAULT_CSS = """
47     Switch {
48         border: tall transparent;
49         background: $boost;
50         height: auto;
51         width: auto;
52         padding: 0 2;
53     }
54 
55     Switch > .switch--slider {
56         background: $panel-darken-2;
57         color: $panel-lighten-2;
58     }
59 
60     Switch:hover {
61         border: tall $background;
62     }
63 
64     Switch:focus {
65         border: tall $accent;
66     }
67 
68     Switch.-on {
69 
70     }
71 
72     Switch.-on > .switch--slider {
73         color: $success;
74     }
75     """
76 
77     value = reactive(False, init=False)
78     """The value of the switch; `True` for on and `False` for off."""
79 
80     slider_pos = reactive(0.0)
81     """The position of the slider."""
82 
83     class Changed(Message, bubble=True):
84         """Posted when the status of the switch changes.
85 
86         Can be handled using `on_switch_changed` in a subclass of `Switch`
87         or in a parent widget in the DOM.
88 
89         Attributes:
90             value: The value that the switch was changed to.
91             switch: The `Switch` widget that was changed.
92         """
93 
94         def __init__(self, switch: Switch, value: bool) -> None:
95             super().__init__()
96             self.value: bool = value
97             self.switch: Switch = switch
98 
99         @property
100         def control(self) -> Switch:
101             """Alias for self.switch."""
102             return self.switch
103 
104     def __init__(
105         self,
106         value: bool = False,
107         *,
108         animate: bool = True,
109         name: str | None = None,
110         id: str | None = None,
111         classes: str | None = None,
112         disabled: bool = False,
113     ):
114         """Initialise the switch.
115 
116         Args:
117             value: The initial value of the switch.
118             animate: True if the switch should animate when toggled.
119             name: The name of the switch.
120             id: The ID of the switch in the DOM.
121             classes: The CSS classes of the switch.
122             disabled: Whether the switch is disabled or not.
123         """
124         super().__init__(name=name, id=id, classes=classes, disabled=disabled)
125         if value:
126             self.slider_pos = 1.0
127             self._reactive_value = value
128         self._should_animate = animate
129 
130     def watch_value(self, value: bool) -> None:
131         target_slider_pos = 1.0 if value else 0.0
132         if self._should_animate:
133             self.animate("slider_pos", target_slider_pos, duration=0.3)
134         else:
135             self.slider_pos = target_slider_pos
136         self.post_message(self.Changed(self, self.value))
137 
138     def watch_slider_pos(self, slider_pos: float) -> None:
139         self.set_class(slider_pos == 1, "-on")
140 
141     def render(self) -> RenderableType:
142         style = self.get_component_rich_style("switch--slider")
143         return ScrollBarRender(
144             virtual_size=100,
145             window_size=50,
146             position=self.slider_pos * 50,
147             style=style,
148             vertical=False,
149         )
150 
151     def get_content_width(self, container: Size, viewport: Size) -> int:
152         return 4
153 
154     def get_content_height(self, container: Size, viewport: Size, width: int) -> int:
155         return 1
156 
157     async def _on_click(self, _: Click) -> None:
158         """Toggle the state of the switch."""
159         self.toggle()
160 
161     def action_toggle(self) -> None:
162         """Toggle the state of the switch."""
163         self.toggle()
164 
165     def toggle(self) -> Self:
166         """Toggle the switch value.
167 
168         As a result of the value changing, a `Switch.Changed` message will
169         be posted.
170 
171         Returns:
172             The `Switch` instance.
173         """
174         self.value = not self.value
175         return self
176
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/textual/widgets/_switch.py b/src/textual/widgets/_switch.py
--- a/src/textual/widgets/_switch.py
+++ b/src/textual/widgets/_switch.py
@@ -154,8 +154,9 @@
     def get_content_height(self, container: Size, viewport: Size, width: int) -> int:
         return 1
 
-    async def _on_click(self, _: Click) -> None:
+    async def _on_click(self, event: Click) -> None:
         """Toggle the state of the switch."""
+        event.stop()
         self.toggle()
 
     def action_toggle(self) -> None:

{"golden_diff": "diff --git a/src/textual/widgets/_switch.py b/src/textual/widgets/_switch.py\n--- a/src/textual/widgets/_switch.py\n+++ b/src/textual/widgets/_switch.py\n@@ -154,8 +154,9 @@\n     def get_content_height(self, container: Size, viewport: Size, width: int) -> int:\n         return 1\n \n-    async def _on_click(self, _: Click) -> None:\n+    async def _on_click(self, event: Click) -> None:\n         \"\"\"Toggle the state of the switch.\"\"\"\n+        event.stop()\n         self.toggle()\n \n     def action_toggle(self) -> None:\n", "issue": "`Switch` should stop the `Click` event from bubbling\nAt the moment `Switch` handles `Click` but then lets it bubble; there's no good reason to do that and it also stops the ability to write something like this:\r\n\r\n```python\r\nfrom textual.app        import App, ComposeResult\r\nfrom textual.containers import Horizontal\r\nfrom textual.widgets    import Header, Footer, Label, Switch\r\n\r\nclass LabeledSwitch( Horizontal ):\r\n\r\n    def on_click( self ) -> None:\r\n        self.query_one(Switch).toggle()\r\n\r\nclass ClickableLabelApp( App[ None ] ):\r\n\r\n    def compose( self ) -> ComposeResult:\r\n        yield Header()\r\n        with LabeledSwitch():\r\n            yield Label( \"Click me!\" )\r\n            yield Switch()\r\n        yield Footer()\r\n\r\nif __name__ == \"__main__\":\r\n    ClickableLabelApp().run()\r\n```\r\n\r\nwhere the idea is to make a compound widget that lets you click on the `Label` or the `Switch` and the `Switch` will toggle -- only it doesn't work if you click on the `Switch` because it ends up double-toggling.\n", "before_files": [{"content": "from __future__ import annotations\n\nfrom typing import TYPE_CHECKING, ClassVar\n\nfrom rich.console import RenderableType\n\nfrom ..binding import Binding, BindingType\nfrom ..events import Click\nfrom ..geometry import Size\nfrom ..message import Message\nfrom ..reactive import reactive\nfrom ..scrollbar import ScrollBarRender\nfrom ..widget import Widget\n\nif TYPE_CHECKING:\n    from typing_extensions import Self\n\n\nclass Switch(Widget, can_focus=True):\n    \"\"\"A switch widget that represents a boolean value.\n\n    Can be toggled by clicking on it or through its [bindings][textual.widgets.Switch.BINDINGS].\n\n    The switch widget also contains [component classes][textual.widgets.Switch.COMPONENT_CLASSES]\n    that enable more customization.\n    \"\"\"\n\n    BINDINGS: ClassVar[list[BindingType]] = [\n        Binding(\"enter,space\", \"toggle\", \"Toggle\", show=False),\n    ]\n    \"\"\"\n    | Key(s) | Description |\n    | :- | :- |\n    | enter,space | Toggle the switch state. |\n    \"\"\"\n\n    COMPONENT_CLASSES: ClassVar[set[str]] = {\n        \"switch--slider\",\n    }\n    \"\"\"\n    | Class | Description |\n    | :- | :- |\n    | `switch--slider` | Targets the slider of the switch. |\n    \"\"\"\n\n    DEFAULT_CSS = \"\"\"\n    Switch {\n        border: tall transparent;\n        background: $boost;\n        height: auto;\n        width: auto;\n        padding: 0 2;\n    }\n\n    Switch > .switch--slider {\n        background: $panel-darken-2;\n        color: $panel-lighten-2;\n    }\n\n    Switch:hover {\n        border: tall $background;\n    }\n\n    Switch:focus {\n        border: tall $accent;\n    }\n\n    Switch.-on {\n\n    }\n\n    Switch.-on > .switch--slider {\n        color: $success;\n    }\n    \"\"\"\n\n    value = reactive(False, init=False)\n    \"\"\"The value of the switch; `True` for on and `False` for off.\"\"\"\n\n    slider_pos = reactive(0.0)\n    \"\"\"The position of the slider.\"\"\"\n\n    class Changed(Message, bubble=True):\n        \"\"\"Posted when the status of the switch changes.\n\n        Can be handled using `on_switch_changed` in a subclass of `Switch`\n        or in a parent widget in the DOM.\n\n        Attributes:\n            value: The value that the switch was changed to.\n            switch: The `Switch` widget that was changed.\n        \"\"\"\n\n        def __init__(self, switch: Switch, value: bool) -> None:\n            super().__init__()\n            self.value: bool = value\n            self.switch: Switch = switch\n\n        @property\n        def control(self) -> Switch:\n            \"\"\"Alias for self.switch.\"\"\"\n            return self.switch\n\n    def __init__(\n        self,\n        value: bool = False,\n        *,\n        animate: bool = True,\n        name: str | None = None,\n        id: str | None = None,\n        classes: str | None = None,\n        disabled: bool = False,\n    ):\n        \"\"\"Initialise the switch.\n\n        Args:\n            value: The initial value of the switch.\n            animate: True if the switch should animate when toggled.\n            name: The name of the switch.\n            id: The ID of the switch in the DOM.\n            classes: The CSS classes of the switch.\n            disabled: Whether the switch is disabled or not.\n        \"\"\"\n        super().__init__(name=name, id=id, classes=classes, disabled=disabled)\n        if value:\n            self.slider_pos = 1.0\n            self._reactive_value = value\n        self._should_animate = animate\n\n    def watch_value(self, value: bool) -> None:\n        target_slider_pos = 1.0 if value else 0.0\n        if self._should_animate:\n            self.animate(\"slider_pos\", target_slider_pos, duration=0.3)\n        else:\n            self.slider_pos = target_slider_pos\n        self.post_message(self.Changed(self, self.value))\n\n    def watch_slider_pos(self, slider_pos: float) -> None:\n        self.set_class(slider_pos == 1, \"-on\")\n\n    def render(self) -> RenderableType:\n        style = self.get_component_rich_style(\"switch--slider\")\n        return ScrollBarRender(\n            virtual_size=100,\n            window_size=50,\n            position=self.slider_pos * 50,\n            style=style,\n            vertical=False,\n        )\n\n    def get_content_width(self, container: Size, viewport: Size) -> int:\n        return 4\n\n    def get_content_height(self, container: Size, viewport: Size, width: int) -> int:\n        return 1\n\n    async def _on_click(self, _: Click) -> None:\n        \"\"\"Toggle the state of the switch.\"\"\"\n        self.toggle()\n\n    def action_toggle(self) -> None:\n        \"\"\"Toggle the state of the switch.\"\"\"\n        self.toggle()\n\n    def toggle(self) -> Self:\n        \"\"\"Toggle the switch value.\n\n        As a result of the value changing, a `Switch.Changed` message will\n        be posted.\n\n        Returns:\n            The `Switch` instance.\n        \"\"\"\n        self.value = not self.value\n        return self\n", "path": "src/textual/widgets/_switch.py"}], "after_files": [{"content": "from __future__ import annotations\n\nfrom typing import TYPE_CHECKING, ClassVar\n\nfrom rich.console import RenderableType\n\nfrom ..binding import Binding, BindingType\nfrom ..events import Click\nfrom ..geometry import Size\nfrom ..message import Message\nfrom ..reactive import reactive\nfrom ..scrollbar import ScrollBarRender\nfrom ..widget import Widget\n\nif TYPE_CHECKING:\n    from typing_extensions import Self\n\n\nclass Switch(Widget, can_focus=True):\n    \"\"\"A switch widget that represents a boolean value.\n\n    Can be toggled by clicking on it or through its [bindings][textual.widgets.Switch.BINDINGS].\n\n    The switch widget also contains [component classes][textual.widgets.Switch.COMPONENT_CLASSES]\n    that enable more customization.\n    \"\"\"\n\n    BINDINGS: ClassVar[list[BindingType]] = [\n        Binding(\"enter,space\", \"toggle\", \"Toggle\", show=False),\n    ]\n    \"\"\"\n    | Key(s) | Description |\n    | :- | :- |\n    | enter,space | Toggle the switch state. |\n    \"\"\"\n\n    COMPONENT_CLASSES: ClassVar[set[str]] = {\n        \"switch--slider\",\n    }\n    \"\"\"\n    | Class | Description |\n    | :- | :- |\n    | `switch--slider` | Targets the slider of the switch. |\n    \"\"\"\n\n    DEFAULT_CSS = \"\"\"\n    Switch {\n        border: tall transparent;\n        background: $boost;\n        height: auto;\n        width: auto;\n        padding: 0 2;\n    }\n\n    Switch > .switch--slider {\n        background: $panel-darken-2;\n        color: $panel-lighten-2;\n    }\n\n    Switch:hover {\n        border: tall $background;\n    }\n\n    Switch:focus {\n        border: tall $accent;\n    }\n\n    Switch.-on {\n\n    }\n\n    Switch.-on > .switch--slider {\n        color: $success;\n    }\n    \"\"\"\n\n    value = reactive(False, init=False)\n    \"\"\"The value of the switch; `True` for on and `False` for off.\"\"\"\n\n    slider_pos = reactive(0.0)\n    \"\"\"The position of the slider.\"\"\"\n\n    class Changed(Message, bubble=True):\n        \"\"\"Posted when the status of the switch changes.\n\n        Can be handled using `on_switch_changed` in a subclass of `Switch`\n        or in a parent widget in the DOM.\n\n        Attributes:\n            value: The value that the switch was changed to.\n            switch: The `Switch` widget that was changed.\n        \"\"\"\n\n        def __init__(self, switch: Switch, value: bool) -> None:\n            super().__init__()\n            self.value: bool = value\n            self.switch: Switch = switch\n\n        @property\n        def control(self) -> Switch:\n            \"\"\"Alias for self.switch.\"\"\"\n            return self.switch\n\n    def __init__(\n        self,\n        value: bool = False,\n        *,\n        animate: bool = True,\n        name: str | None = None,\n        id: str | None = None,\n        classes: str | None = None,\n        disabled: bool = False,\n    ):\n        \"\"\"Initialise the switch.\n\n        Args:\n            value: The initial value of the switch.\n            animate: True if the switch should animate when toggled.\n            name: The name of the switch.\n            id: The ID of the switch in the DOM.\n            classes: The CSS classes of the switch.\n            disabled: Whether the switch is disabled or not.\n        \"\"\"\n        super().__init__(name=name, id=id, classes=classes, disabled=disabled)\n        if value:\n            self.slider_pos = 1.0\n            self._reactive_value = value\n        self._should_animate = animate\n\n    def watch_value(self, value: bool) -> None:\n        target_slider_pos = 1.0 if value else 0.0\n        if self._should_animate:\n            self.animate(\"slider_pos\", target_slider_pos, duration=0.3)\n        else:\n            self.slider_pos = target_slider_pos\n        self.post_message(self.Changed(self, self.value))\n\n    def watch_slider_pos(self, slider_pos: float) -> None:\n        self.set_class(slider_pos == 1, \"-on\")\n\n    def render(self) -> RenderableType:\n        style = self.get_component_rich_style(\"switch--slider\")\n        return ScrollBarRender(\n            virtual_size=100,\n            window_size=50,\n            position=self.slider_pos * 50,\n            style=style,\n            vertical=False,\n        )\n\n    def get_content_width(self, container: Size, viewport: Size) -> int:\n        return 4\n\n    def get_content_height(self, container: Size, viewport: Size, width: int) -> int:\n        return 1\n\n    async def _on_click(self, event: Click) -> None:\n        \"\"\"Toggle the state of the switch.\"\"\"\n        event.stop()\n        self.toggle()\n\n    def action_toggle(self) -> None:\n        \"\"\"Toggle the state of the switch.\"\"\"\n        self.toggle()\n\n    def toggle(self) -> Self:\n        \"\"\"Toggle the switch value.\n\n        As a result of the value changing, a `Switch.Changed` message will\n        be posted.\n\n        Returns:\n            The `Switch` instance.\n        \"\"\"\n        self.value = not self.value\n        return self\n", "path": "src/textual/widgets/_switch.py"}]}