diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j index 74c670605..2340467ff 100644 --- a/AppKit/CPTextField.j +++ b/AppKit/CPTextField.j @@ -432,6 +432,8 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); // We only allow first responder status if the field is enabled. if (!shouldBeEnabled && [[self window] firstResponder] === self) [[self window] makeFirstResponder:nil]; + + [self _setCSSSelectionStyleForDOMElement]; } /*! @@ -441,6 +443,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); - (void)setSelectable:(BOOL)aFlag { _isSelectable = aFlag; + [self _setCSSSelectionStyleForDOMElement]; } /*! @@ -700,6 +703,20 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); return YES; } +/*! + Set the selection css style for the DOM element of the textField + @ignore +*/ +- (void)_setCSSSelectionStyleForDOMElement +{ +#if PLATFORM (DOM) + if (_isSelectable && [self isEnabled]) + _DOMElement.style[CPBrowserStyleProperty(@"user-select")] = @"text"; + else + _DOMElement.style[CPBrowserStyleProperty(@"user-select")] = @"none"; +#endif +} + /*! Set the css style for the input element of the textField @ignore diff --git a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j index fa6dd7ec8..e96a5708c 100644 --- a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j +++ b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j @@ -365,6 +365,7 @@ _CPPlatformWindowWillCloseNotification = @"_CPPlatformWindowWillCloseNotificatio _DOMBodyElement.style["-khtml-user-select"] = "none"; _DOMBodyElement.webkitTouchCallout = "none"; + _DOMBodyElement.style[CPBrowserStyleProperty(@"user-select")] = @"none"; [self createDOMElements]; [self _addLayers];