Browse Source

Block the scroll elements from propagating drag events up the element chain

In particular, this caused an issue where we could "drag" through the scroll track, which could lead to selecting text in a parent textarea.
Michael Ragazzon 1 year ago
parent
commit
312bad7c30
1 changed files with 2 additions and 0 deletions
  1. 2 0
      Source/Core/ElementScroll.cpp

+ 2 - 0
Source/Core/ElementScroll.cpp

@@ -210,6 +210,7 @@ bool ElementScroll::CreateScrollbar(Orientation orientation)
 		Factory::InstanceElement(element, "*", orientation == VERTICAL ? "scrollbarvertical" : "scrollbarhorizontal", XMLAttributes());
 		Factory::InstanceElement(element, "*", orientation == VERTICAL ? "scrollbarvertical" : "scrollbarhorizontal", XMLAttributes());
 	scrollbars[orientation].element = scrollbar_element.get();
 	scrollbars[orientation].element = scrollbar_element.get();
 	scrollbars[orientation].element->SetProperty(PropertyId::Clip, Property(1, Unit::NUMBER));
 	scrollbars[orientation].element->SetProperty(PropertyId::Clip, Property(1, Unit::NUMBER));
+	scrollbars[orientation].element->SetProperty(PropertyId::Drag, Property(Style::Drag::Block));
 
 
 	scrollbars[orientation].widget = MakeUnique<WidgetScroll>(scrollbars[orientation].element);
 	scrollbars[orientation].widget = MakeUnique<WidgetScroll>(scrollbars[orientation].element);
 	scrollbars[orientation].widget->Initialise(orientation == VERTICAL ? WidgetScroll::VERTICAL : WidgetScroll::HORIZONTAL);
 	scrollbars[orientation].widget->Initialise(orientation == VERTICAL ? WidgetScroll::VERTICAL : WidgetScroll::HORIZONTAL);
@@ -229,6 +230,7 @@ bool ElementScroll::CreateCorner()
 	ElementPtr corner_element = Factory::InstanceElement(element, "*", "scrollbarcorner", XMLAttributes());
 	ElementPtr corner_element = Factory::InstanceElement(element, "*", "scrollbarcorner", XMLAttributes());
 	corner = corner_element.get();
 	corner = corner_element.get();
 	corner->SetProperty(PropertyId::Clip, Property(1, Unit::NUMBER));
 	corner->SetProperty(PropertyId::Clip, Property(1, Unit::NUMBER));
+	corner->SetProperty(PropertyId::Drag, Property(Style::Drag::Block));
 
 
 	Element* child = element->AppendChild(std::move(corner_element), false);
 	Element* child = element->AppendChild(std::move(corner_element), false);
 	UpdateScrollElementProperties(child);
 	UpdateScrollElementProperties(child);