royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com.INVALID>
Subject Re: [royale-asjs] branch develop updated: Removed unselectable selector
Date Mon, 04 Jun 2018 16:07:24 GMT
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" <harbs.lists@gmail.com> 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 <aharui@adobe.com.INVALID> 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" <harbs.lists@gmail.com <mailto:harbs.lists@gmail.com>>
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 <carlosrovira@apache.org> 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 <aharui@adobe.com.invalid>:
    >> 
    >>> 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" <harbs.lists@gmail.com> 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, harbs@apache.org 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%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Froyale-
    >>> asjs.git&data=02%7C01%7Caharui%40adobe.com%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 <harbs@in-tools.com>
    >>>> 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
    >>>> harbs@apache.org.
    >>> 
    >>> 
    >>> 
    >>> 
    >> 
    >> 
    >> -- 
    >> 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>
    

Mime
View raw message