material icon indicating copy to clipboard operation
material copied to clipboard

Md-Tab-Item Should Disable Text Selection?

Open j-meyer opened this issue 11 years ago • 7 comments

I'm not sure if this is a bug or not, but I feel like md-tab-item should by default have user-select: none; as part of its style, otherwise when a user clicks on a tab, it's possible for the label in the tab to be selected and it looks weird.

j-meyer avatar May 21 '15 13:05 j-meyer

you could try user-select: none in your css, solves it for me.

e.g. for the whole page

*:not(input, textarea), 
*:not(input, textarea):after, 
*:not(input, textarea):before {
    -webkit-user-select: none;
    -ms-user-select: none;
    -moz-user-select: -moz-none;
    user-select: none;
}

cpae avatar Jun 09 '15 14:06 cpae

@cnpal Not sure if you meant that snippet to be sent through a preprocessor, but in a plain-old stylesheet it needs to be:

:not(input):not(textarea),
:not(input):not(textarea):after,
:not(input):not(textarea):before {
    -webkit-user-select: none;
    -ms-user-select: none;
    -moz-user-select: -moz-none;
    user-select: none;
}

Also note using the universal selector (*) is redundant.

See https://developer.mozilla.org/en-US/docs/Web/CSS/%3Anot#Browser_compatibility and http://dev.w3.org/csswg/selectors-3/#simple-selectors-dfn

OlsonDev avatar Jun 24 '15 15:06 OlsonDev

You're right, copy and paste error from my side, sorry. But i guess you get the idea ;)

cpae avatar Jun 25 '15 14:06 cpae

I know how to disable the selection, it was more of a question if the framework should default to disabling that selection or if the consumer of the framework would be responsible for setting that css.

j-meyer avatar Jun 25 '15 14:06 j-meyer

What I did for now was

  md-tab-item {
      -webkit-user-select: none;  
      -moz-user-select: none;  
      -ms-user-select: none;
} 

j-meyer avatar Jun 25 '15 14:06 j-meyer

Sorry @CSHMcLovin, I didn't mean to hijack your issue; I agree the framework should default to user-select: none for md-tab-item. I came across your issue because some other md-... directive had the same issue. I just wanted to correct the temporary workaround @cnpal provided for others who come across this page.

OlsonDev avatar Jun 25 '15 14:06 OlsonDev

No worries

j-meyer avatar Jun 25 '15 14:06 j-meyer