[wp-trac] [WordPress Trac] #40686: CSS: introduce naming and usage conventions for JS targeting

WordPress Trac noreply at wordpress.org
Thu May 6 14:14:42 UTC 2021


#40686: CSS: introduce naming and usage conventions for JS targeting
----------------------------+------------------------------
 Reporter:  afercia         |       Owner:  (none)
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:  ui, css
----------------------------+------------------------------

Comment (by notlaura):

 We discussed this in the Core CSS chat on April 15, 2021 and generally
 agreed on the following approach:

 1. Using the `.js-` namespace for classes that are used for JS targeting
 e.g. `.js-toggle-panel`
 2. These classes should not have styling attached to them, instead styling
 that is applied with JS controlled class toggle should use stateful
 `.is-*` classes e.g. `.is-toggle-panel-open`
 3. We need to determine a workflow for updating selectors in the JS and
 identify third party plugins that might rely on them for JS purposes

 Regarding the third point, there is a ticket for determining a deprecation
 path for core CSS (see #53070), and that workflow might be relevant here,
 too.

 Does anyone have feedback on the above points? We also discussed bringing
 this up in dev-chat for some more visibility if it is to be adopted as a
 standard.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/40686#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list