electron: Couldn't set selectedTextBackgroundColor from default ()

Getting this error on OS X:

2016-02-08 09:43:16.059 Electron Helper[36152:2174695] Couldn't set selectedTextBackgroundColor from default ()

I have a style that looks like this that I believe is triggering the error:

#myId::selection {
    background: #3399ff;
}

This ::selection selector allows you to apply a specific style to the selected text, in my case in a <textarea> tag.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 16 (3 by maintainers)

Commits related to this issue

Most upvoted comments

I have a simple solution, put

<style> ::selection { background: white; /* WebKit/Blink Browsers */ } </style>

in the enterence of html, like index.html

This bug will disappear. @zcbenz

Elaborating on the idea from @wuqunfei, here is CSS that when added to the normal CSS file of your Electron project will prevent this error message from showing in the console when a user selects some text:

::selection { background:transparent; }

If you want the user’s text selection to appear normal, then change the “transparent” above to a color such as this:

::selection { background:rgba(255, 255, 125, 0.99); color:#032764; }

You can get the same warning for Chrome browser, it is not actually related to the style, if happens when you select some text in page.

If you really care about this I would suggest reporting this to Chromium’s issues list.

It looks like this was fixed in Chromium a week ago, and the status was changed today. Now we just have to wait for this to work its way into Electron…

@wuqunfei @RichLewis007

Hi, I’m try the way to set <style> but still receive the warning.

My Electron is newist, how should i resolve the issue now ? thank you

3.0.13

This issue only appears when you open the dev tools.

I got this error in a transparent window. I didn’t have ::selection in my case. Is there any way to bypass this warning?