Fair enough. Of course the styling could also be a bead…
> On Jun 4, 2018, at 7:14 PM, Alex Harui <[email protected]> wrote: > > IMO, it is easier for folks to know that there is a selector to override or > add styles to if it is in one of our .css files instead of buried in code. > > My 2 cents, > -Alex > > On 6/4/18, 9:11 AM, "Harbs" <[email protected] > <mailto:[email protected]>> wrote: > >> I don't know why someone would want to override unselectable styles, but the >> first idea that popped into my head was a different background color so >> folks knew not to even bother to select text in the unselectable controls. >> Another possibility is that there are other styles that may be needed >> someday that control how screen readers deal with unselectable controls. > > Ah. You mean add additional styles. There’s no reason they couldn’t add an > additional .unselectable selector with styling elsewhere in the CSS. I could > go either way on this. If folks feel strongly it should be a “proper” > selector, I’ll do that. > > Thanks, > Harbs > >> On Jun 4, 2018, at 7:07 PM, Alex Harui <[email protected]> wrote: >> >> Feel free to change the name of the bead so that the Type Selector name >> looks "better". I think we agreed to drop the "Bead" portion of names going >> forward. >> >> If you are absolutely sure nobody will ever need to override what is in that >> selector, then I'm fine with injecting it with code and using the new >> utility function you created, but otherwise, I would hope we try to write >> the framework without injecting styles with code. Having overrideable >> selectors should be the recommended practice for a framework. We want >> everything to be override-able. >> >> I don't know why someone would want to override unselectable styles, but the >> first idea that popped into my head was a different background color so >> folks knew not to even bother to select text in the unselectable controls. >> Another possibility is that there are other styles that may be needed >> someday that control how screen readers deal with unselectable controls. >> >> My 2 cents, >> -Alex >> >> On 6/4/18, 8:48 AM, "Harbs" <[email protected] >> <mailto:[email protected]> <mailto:[email protected] >> <mailto:[email protected]>>> wrote: >> >> That would probably work. I’m not totally happy with that selector name. >> >> I can switch the implementation if you think that’s better. I’m not sure >> why a user would override an “unelectable” style though. >> >> Harbs >> >>> On Jun 4, 2018, at 6:45 PM, Alex Harui <[email protected] >>> <mailto:[email protected]>> wrote: >>> >>> Hi Harbs, >>> >>> My suggestion for adding the selector is to make the selector look like a >>> Type/Element Selector with the name "UnselectableElementBead". If you do >>> that, then wouldn't that selector be dropped out if nobody is using >>> UnselectableElementBead? >>> >>> I would hope we could find a solution that doesn't result in code injecting >>> styles as that sort of screws up users overriding those styles. >>> >>> My 2 cents, >>> -Alex >>> >>> On 6/4/18, 1:14 AM, "Harbs" <[email protected] >>> <mailto:[email protected]> <mailto:[email protected] >>> <mailto:[email protected]>> <mailto:[email protected] >>> <mailto:[email protected]> <mailto:[email protected] >>> <mailto:[email protected]>>>> wrote: >>> >>> It does add the style to the class list. >>> >>> The only question is how to add the selector to the CSS. >>> >>> Thanks, >>> Harbs >>> >>>> On Jun 4, 2018, at 10:24 AM, Carlos Rovira <[email protected] >>>> <mailto:[email protected]> <mailto:[email protected] >>>> <mailto:[email protected]>>> wrote: >>>> >>>> Hi, >>>> >>>> I think as Alex that better way for this is the bead add the css style to >>>> classList. >>>> >>>> thanks >>>> >>>> 2018-06-04 6:33 GMT+02:00 Alex Harui <[email protected] >>>> <mailto:[email protected]> <mailto:[email protected] >>>> <mailto:[email protected]>>>: >>>> >>>>> IMO, the better fix would be to just rename the selector in defaults.css >>>>> to be UnselectableElementBead and have UnselectableElementBead add >>>>> "UnselectableElementBead" to the classList. >>>>> >>>>> Or am I not understanding what this does? >>>>> >>>>> -Alex >>>>> >>>>> >>>>> On 6/2/18, 1:59 PM, "Harbs" <[email protected] >>>>> <mailto:[email protected]> <mailto:[email protected] >>>>> <mailto:[email protected]>>> wrote: >>>>> >>>>> What I really wanted to do here was create some self invoking code >>>>> which was run when the UnselectableElementBead class was loaded. >>>>> >>>>> Is there any way of doing that without writing a static method and >>>>> invoking that? >>>>> >>>>> Thanks, >>>>> Harbs >>>>> >>>>> >>>>>> On Jun 2, 2018, at 11:39 PM, [email protected] <mailto:[email protected]> >>>>>> <mailto:[email protected] <mailto:[email protected]>> wrote: >>>>>> >>>>>> This is an automated email from the ASF dual-hosted git repository. >>>>>> >>>>>> harbs pushed a commit to branch develop >>>>>> in repository https://na01.safelinks.protection.outlook.com/?url= >>>>>> <https://na01.safelinks.protection.outlook.com/?url=> >>>>>> <https://na01.safelinks.protection.outlook.com/?url= >>>>>> <https://na01.safelinks.protection.outlook.com/?url=>> >>>>> https%3A%2F%2Fgitbox.apache.org <http://2fgitbox.apache.org/> >>>>> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2F2fgitbox.apache.org%2F&data=02%7C01%7Caharui%40adobe.com%7Ca8de91c11d41468c153408d5ca35d05d%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636637254910818301&sdata=Xr5tZDig%2BPpAl68ui241tHM6qpGXRAA1yy0B2EBxMUA%3D&reserved=0 >>>>> >>>>> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2F2fgitbox.apache.org%2F&data=02%7C01%7Caharui%40adobe.com%7Ca8de91c11d41468c153408d5ca35d05d%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636637254910818301&sdata=Xr5tZDig%2BPpAl68ui241tHM6qpGXRAA1yy0B2EBxMUA%3D&reserved=0>>%2Frepos%2Fasf%2Froyale- >>>>> asjs.git&data=02%7C01%7Caharui%40adobe.com <http://40adobe.com/> >>>>> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2F40adobe.com%2F&data=02%7C01%7Caharui%40adobe.com%7Ca8de91c11d41468c153408d5ca35d05d%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636637254910818301&sdata=uMP84RHRsCfwyCVNFU%2FAKFJ29uOPPhHegA3xId3nv2s%3D&reserved=0 >>>>> >>>>> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2F40adobe.com%2F&data=02%7C01%7Caharui%40adobe.com%7Ca8de91c11d41468c153408d5ca35d05d%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636637254910818301&sdata=uMP84RHRsCfwyCVNFU%2FAKFJ29uOPPhHegA3xId3nv2s%3D&reserved=0>>%7C9369538a50114755520308d5c8cb >>>>> b09c%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0% >>>>> 7C636635699536531937&sdata=iPymBmOQfeD1312Szlsc6Fwc4E5GU2 >>>>> Kj3OwfvmWh%2Bzk%3D&reserved=0 >>>>>> >>>>>> >>>>>> The following commit(s) were added to refs/heads/develop by this >>>>> push: >>>>>> new b157ecf Removed unselectable selector >>>>>> b157ecf is described below >>>>>> >>>>>> commit b157ecff5ea11ff2035e105f266b0925c1970005 >>>>>> Author: Harbs <[email protected] <mailto:[email protected]> >>>>>> <mailto:[email protected] <mailto:[email protected]>>> >>>>>> AuthorDate: Sat Jun 2 23:39:28 2018 +0300 >>>>>> >>>>>> Removed unselectable selector >>>>>> --- >>>>>> .../projects/Basic/src/main/resources/defaults.css | 9 --------- >>>>>> .../royale/html/beads/UnselectableElementBead.as | 22 >>>>> ++++++++++++++++++++++ >>>>>> 2 files changed, 22 insertions(+), 9 deletions(-) >>>>>> >>>>>> diff --git a/frameworks/projects/Basic/src/main/resources/defaults.css >>>>> b/frameworks/projects/Basic/src/main/resources/defaults.css >>>>>> index ea02120..23a324d 100644 >>>>>> --- a/frameworks/projects/Basic/src/main/resources/defaults.css >>>>>> +++ b/frameworks/projects/Basic/src/main/resources/defaults.css >>>>>> @@ -26,15 +26,6 @@ >>>>>> box-sizing: border-box; >>>>>> } >>>>>> >>>>>> -.unselectable >>>>>> -{ >>>>>> - -moz-user-select: -moz-none; >>>>>> - -khtml-user-select: none; >>>>>> - -webkit-user-select: none; >>>>>> - -o-user-select: none; >>>>>> - user-select: none; >>>>>> -} >>>>>> - >>>>>> Alert >>>>>> { >>>>>> IBeadLayout: ClassReference("org.apache.royale.html.beads.layouts. >>>>> VerticalFlexLayout"); >>>>>> diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/ >>>>> royale/html/beads/UnselectableElementBead.as b/frameworks/projects/Basic/ >>>>> src/main/royale/org/apache/royale/html/beads/UnselectableElementBead.as >>>>>> index 6697472..c80c907 100644 >>>>>> --- a/frameworks/projects/Basic/src/main/royale/org/apache/ >>>>> royale/html/beads/UnselectableElementBead.as >>>>>> +++ b/frameworks/projects/Basic/src/main/royale/org/apache/ >>>>> royale/html/beads/UnselectableElementBead.as >>>>>> @@ -34,6 +34,27 @@ package org.apache.royale.html.beads >>>>>> public class UnselectableElementBead implements IBead >>>>>> { >>>>>> /** >>>>>> + * @royaleignorecoercion HTMLStyleElement >>>>>> + */ >>>>>> + private static function insertRule():void >>>>>> + { >>>>>> + // only do this once... >>>>>> + if(ruleInserted) >>>>>> + return; >>>>>> + ruleInserted = true; >>>>>> + // Inject a new css selector >>>>>> + COMPILE::JS >>>>>> + { >>>>>> + var style:HTMLStyleElement = >>>>> document.createElement('style') as HTMLStyleElement; >>>>>> + style.type = 'text/css'; >>>>>> + style.innerHTML = '.unselectable >>>>> {-moz-user-select: none;-webkit-user-select: none;-ms-user-select: >>>>> none;user-select: none;}'; >>>>>> + document.getElementsByTagName( >>>>> 'head')[0].appendChild(style); >>>>>> + } >>>>>> + >>>>>> + } >>>>>> + private static var ruleInserted:Boolean; >>>>>> + >>>>>> + /** >>>>>> * constructor. >>>>>> * >>>>>> * @langversion 3.0 >>>>>> @@ -57,6 +78,7 @@ package org.apache.royale.html.beads >>>>>> */ >>>>>> public function set strand(value:IStrand):void >>>>>> { >>>>>> + insertRule(); >>>>>> _strand = value; >>>>>> >>>>>> COMPILE::JS >>>>>> >>>>>> -- >>>>>> To stop receiving notification emails like this one, please contact >>>>>> [email protected] <mailto:[email protected]> <mailto:[email protected] >>>>>> <mailto:[email protected]>>. >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> -- >>>> Carlos Rovira >>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7C0bd6353a12104f5326d708d5c9f332c7%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636636968773528501&sdata=v8vk8mHKjoAN3D0lexy3vhXcOWVeYYc1HDouygyKoE8%3D&reserved=0 >>>> >>>> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7C0bd6353a12104f5326d708d5c9f332c7%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636636968773528501&sdata=v8vk8mHKjoAN3D0lexy3vhXcOWVeYYc1HDouygyKoE8%3D&reserved=0><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7C0bd6353a12104f5326d708d5c9f332c7%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636636968773528501&sdata=v8vk8mHKjoAN3D0lexy3vhXcOWVeYYc1HDouygyKoE8%3D&reserved=0 >>>> >>>> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7C0bd6353a12104f5326d708d5c9f332c7%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636636968773528501&sdata=v8vk8mHKjoAN3D0lexy3vhXcOWVeYYc1HDouygyKoE8%3D&reserved=0>><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7C0bd6353a12104f5326d708d5c9f332c7%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636636968773528501&sdata=v8vk8mHKjoAN3D0lexy3vhXcOWVeYYc1HDouygyKoE8%3D&reserved=0 >>>> >>>> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7C0bd6353a12104f5326d708d5c9f332c7%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636636968773528501&sdata=v8vk8mHKjoAN3D0lexy3vhXcOWVeYYc1HDouygyKoE8%3D&reserved=0><https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7C0bd6353a12104f5326d708d5c9f332c7%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636636968773528501&sdata=v8vk8mHKjoAN3D0lexy3vhXcOWVeYYc1HDouygyKoE8%3D&reserved=0 >>>> >>>> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7C0bd6353a12104f5326d708d5c9f332c7%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636636968773528501&sdata=v8vk8mHKjoAN3D0lexy3vhXcOWVeYYc1HDouygyKoE8%3D&reserved=0>>>
