text_view: Stop propagation on click link in TextView. (#650)
To avoid trigger parent element, for example as a Label for checkbox.
This commit is contained in:
parent
6bcc34c7f0
commit
3b4065ce4e
1 changed files with 4 additions and 0 deletions
|
|
@ -303,6 +303,10 @@ impl RenderOnce for Paragraph {
|
|||
let links = links.clone();
|
||||
move |ix, _, cx| {
|
||||
if let Some((_, link)) = &links.get(ix) {
|
||||
// Stop propagation to prevent the parent element from handling the event.
|
||||
//
|
||||
// For example the text in a checkbox label, click link need avoid toggle check state.
|
||||
cx.stop_propagation();
|
||||
cx.open_url(&link.url);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue