{"id":4034,"date":"2024-09-26T09:45:13","date_gmt":"2024-09-26T14:45:13","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=4034"},"modified":"2024-09-26T09:45:14","modified_gmt":"2024-09-26T14:45:14","slug":"opt-in-styleable-selects","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/opt-in-styleable-selects\/","title":{"rendered":"Opt-In Styleable Selects"},"content":{"rendered":"\n<p>We <a href=\"https:\/\/frontendmasters.com\/blog\/arrival-of-animate-to-auto\/\">just looked at<\/a> how &#8220;animate to auto&#8221; (e.g. <code>transition<\/code> from a fixed value to a keyword like <code>auto<\/code>, <code>max-content<\/code>, etc.) is &#8220;opt-in&#8221; in a sense. You have to use <code>interpolate-size: allow-keywords;<\/code> to make it work or use a function like <code>calc-size()<\/code>, neither of which you accidentally do. This is because <a href=\"https:\/\/github.com\/w3c\/csswg-drafts\/issues\/626#issuecomment-2071016522\">research<\/a> showed that it would break things just enough to be annoying and the web don&#8217;t play like that. <\/p>\n\n\n\n<p>In the same vein, there has been work done on making a &#8220;styleable&#8221; <code>&lt;select><\/code> element (as in, CSS control over what it looks like when you open it, which has never really been possible). This is another thing that <em>needs<\/em> to be opt-in, lest break websites (imagine CSS applied to a select menu accidentally that will all the sudden start working and cause who knows what all chaos). At first, it was going to be a new element <code>&lt;selectmenu><\/code>, which is maybe OK but quite hard to progressive enhance toward. Now things are pointing toward this opt-in:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">select<\/span>,\n<span class=\"hljs-selector-pseudo\">::picker(select)<\/span> {\n  <span class=\"hljs-attribute\">appearance<\/span>: base-select;\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/developer.chrome.com\/blog\/rfc-customizable-select\">Una has the whole story.<\/a> The demos are compelling, and can even <a href=\"https:\/\/nerdy.dev\/custom-select-with-transitions-boilerplate\">be animated<\/a>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>We just looked at how &#8220;animate to auto&#8221; (e.g. transition from a fixed value to a keyword like auto, max-content, etc.) is &#8220;opt-in&#8221; in a sense. You have to use interpolate-size: allow-keywords; to make it work or use a function like calc-size(), neither of which you accidentally do. This is because research showed that it [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4036,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29],"tags":[7,50],"class_list":["post-4034","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-the-beat","tag-css","tag-select"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/09\/select-fallback_1920.png?fit=1218%2C678&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/4034","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=4034"}],"version-history":[{"count":1,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/4034\/revisions"}],"predecessor-version":[{"id":4035,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/4034\/revisions\/4035"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/4036"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=4034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=4034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=4034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}