[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"verticals":3,"quiz-css-transition-behavior-allow-discrete":44,"search-suggestions":60,"quiz-article-css-transition-behavior-allow-discrete":109,"path-membership-css-transition-behavior-allow-discrete":312},[4,20,32],{"id":5,"slug":6,"name":7,"tagline":8,"description":9,"accentFrom":10,"accentTo":11,"icon":12,"defaultLocale":13,"locales":14,"features":16,"position":19},"019fe637-3d33-714b-b57f-23e163ffca0c","dev","Web Development","Read it. Run it. Prove it.","A post a day on modern web development — most with an editable playground and a quiz that explains every answer. Free, no account needed.","violet-500","cyan-400","◇","en",[13,15],"fa",{"courses":17,"paths":17,"articles":17,"exams":18,"flashcards":18,"packages":17,"community":17,"certificates":17,"teams":17,"commerce":17},true,false,0,{"id":21,"slug":22,"name":23,"tagline":24,"description":25,"accentFrom":26,"accentTo":10,"icon":27,"defaultLocale":13,"locales":28,"features":30,"position":31},"019fe637-3dc2-754c-8657-0f175bfee7c6","lang","Languages","Learn a language the way you learn a codebase.","Grammar explained the way good documentation explains an API — one idea at a time, each with a quiz.","amber-400","⌘",[13,15,29],"es",{"courses":18,"paths":18,"articles":17,"exams":18,"flashcards":17,"packages":18,"community":17,"certificates":17,"teams":18,"commerce":18},2,{"id":33,"slug":34,"name":35,"tagline":36,"description":37,"accentFrom":38,"accentTo":39,"icon":40,"defaultLocale":13,"locales":41,"features":42,"position":43},"7b3c16f2-931d-410e-802e-e1fa4edab7de","soft","Soft Skills","The half of the job nobody wrote documentation for.","Weekly, on the parts of working life that decide more than your code does — first weeks, meetings, interviews, promotions, and the people around you. Written from what actually happens, and recorded as a podcast you can listen to on the walk.","emerald-400","teal-300","◉",[13],{"courses":18,"paths":18,"articles":17,"exams":18,"flashcards":18,"packages":18,"community":17,"certificates":18,"teams":18,"commerce":18},3,{"id":45,"slug":46,"kind":47,"title":48,"description":49,"config":50,"verticalId":5,"vertical":55,"course":52,"_count":56,"access":57,"attempts":59,"questionCount":51},"01a1fce0-c418-77ce-b0bd-5289f2d9a567","css-transition-behavior-allow-discrete","PRACTICE_QUIZ","transition-behavior: allow-discrete","Eight questions on why display can't fade on its own, and what allow-discrete and @starting-style actually fix.",{"questionCount":51,"timeLimitSec":52,"shuffleQuestions":18,"shuffleOptions":17,"negativeMarking":19,"passScorePct":53,"maxAttempts":52,"revealAnswers":54,"allowFlagging":18,"allowBacktracking":17},8,null,70,"AFTER_SUBMIT",{"slug":6,"name":7},{"questions":51},{"allowed":17,"reason":58},"FREE",[],[61,65,69,73,77,81,85,89,93,97,101,105],{"slug":62,"name":63,"articles":64},"webdev","Webdev",195,{"slug":66,"name":67,"articles":68},"javascript","Javascript",156,{"slug":70,"name":71,"articles":72},"frontend","Frontend",103,{"slug":74,"name":75,"articles":76},"tutorial","Tutorial",85,{"slug":78,"name":79,"articles":80},"css","Css",56,{"slug":82,"name":83,"articles":84},"typescript","Typescript",36,{"slug":86,"name":87,"articles":88},"performance","Performance",33,{"slug":90,"name":91,"articles":92},"programming","Programming",26,{"slug":94,"name":95,"articles":96},"react","React",23,{"slug":98,"name":99,"articles":100},"node","Node",19,{"slug":102,"name":103,"articles":104},"browser","Browser",18,{"slug":106,"name":107,"articles":108},"nextjs","Nextjs",13,{"id":110,"slug":46,"title":111,"subtitle":52,"excerpt":112,"coverUrl":113,"locale":13,"readingMinutes":114,"publishedAt":115,"viewCount":108,"likeCount":19,"commentCount":19,"author":116,"vertical":121,"topic":122,"tags":124,"_count":129,"playground":131,"body":133,"bodyMd":299,"seo":300,"translationGroupId":302,"series":52,"podcastUrl":52,"verticalId":5,"thread":303,"assessments":305,"translations":308,"quiz":310},"01a1fce0-c3d4-737b-8a48-5669d1350ff2","CSS Transitions Skip display: none. transition-behavior Fixes That.","You can finally animate a dialog in from display: none without JavaScript — transition-behavior and @starting-style turn the jump-cut into a real transition.","\u002Fmedia\u002Fcovers\u002Fcss-transition-behavior-allow-discrete.png",6,"2026-11-27T11:46:28.711Z",{"id":117,"name":118,"username":119,"avatarUrl":52,"headline":120},"019fe637-3c25-7088-9034-39c9f15dc3c8","Parsa Jiravand","parsa","Frontend engineer · building bestpractic",{"slug":6,"name":7,"accentFrom":10,"accentTo":11},{"slug":78,"name":123},"CSS",[125,126,127,128],{"slug":78,"name":79,"color":52},{"slug":62,"name":63,"color":52},{"slug":70,"name":71,"color":52},{"slug":74,"name":75,"color":52},{"assessments":130},1,{"slug":46,"title":132},"transition-behavior: allow-discrete — interactive playground",{"blocks":134,"version":130},[135,139,142,145,148,153,156,159,162,167,170,173,176,179,183,186,189,193,196,199,206,209,212,215,218,221,224,227,230,233,236,239,242,245,248,251,254,257,260,263,266,269,272,275,281,284,287,290,293],{"id":136,"html":137,"type":138},"b1","\u003Cp>You build a dialog. You add \u003Ccode>transition: opacity 0.2s, transform 0.2s\u003C\u002Fcode>. You open it.\u003C\u002Fp>","paragraph",{"id":140,"html":141,"type":138},"b2","\u003Cp>It just appears. No fade, no slide — a jump-cut, like someone spliced the film.\u003C\u002Fp>",{"id":143,"html":144,"type":138},"b3","\u003Cp>You check the transition is spelled right. It is. You check the element is actually changing opacity. It is — from \u003Ccode>0\u003C\u002Fcode> to \u003Ccode>1\u003C\u002Fcode>, exactly like you wrote it. So why does it still snap?\u003C\u002Fp>",{"id":146,"html":147,"type":138},"b4","\u003Cp>Because the element isn&#39;t only changing opacity. It&#39;s also going from \u003Ccode>display: none\u003C\u002Fcode> to \u003Ccode>display: block\u003C\u002Fcode>, and CSS has never known how to transition that.\u003C\u002Fp>",{"id":149,"html":150,"text":151,"type":152,"level":31},"b5","The property transitions can&#39;t touch","The property transitions can't touch","heading",{"id":154,"html":155,"type":138},"b6","\u003Cp>\u003Ccode>display\u003C\u002Fcode> isn&#39;t a number, a color, or a length. You can interpolate \u003Ccode>opacity: 0\u003C\u002Fcode> to \u003Ccode>opacity: 1\u003C\u002Fcode> because the browser can compute every value in between — \u003Ccode>0.3\u003C\u002Fcode>, \u003Ccode>0.7\u003C\u002Fcode>, whatever the easing curve wants at that frame. There is no value &quot;in between&quot; \u003Ccode>none\u003C\u002Fcode> and \u003Ccode>block\u003C\u002Fcode>. An element is either laid out or it isn&#39;t.\u003C\u002Fp>",{"id":157,"html":158,"type":138},"b7","\u003Cp>Properties like this are \u003Cstrong>discrete\u003C\u002Fstrong>: \u003Ccode>display\u003C\u002Fcode>, \u003Ccode>content-visibility\u003C\u002Fcode>, \u003Ccode>overlay\u003C\u002Fcode>, \u003Ccode>visibility\u003C\u002Fcode> (sort of — more on that below). The browser&#39;s only option has always been to flip them the instant the transition starts, which for \u003Ccode>display\u003C\u002Fcode> means \u003Ccode>none → block\u003C\u002Fcode> happens at frame zero, before your opacity transition even gets going.\u003C\u002Fp>",{"id":160,"html":161,"type":138},"b8","\u003Cp>So the classic workaround was: don&#39;t touch \u003Ccode>display\u003C\u002Fcode> at all.\u003C\u002Fp>",{"id":163,"code":164,"type":165,"language":78,"highlight":166},"b9",".modal {\n  opacity: 0;\n  visibility: hidden;\n  transition: opacity 0.2s, visibility 0.2s;\n}\n.modal.open {\n  opacity: 1;\n  visibility: visible;\n}","code",[],{"id":168,"html":169,"type":138},"b10","\u003Cp>\u003Ccode>visibility\u003C\u002Fcode> gets special-cased by the spec — browsers flip it to \u003Ccode>visible\u003C\u002Fcode> at the \u003Cem>start\u003C\u002Fem> of the duration when opening, and to \u003Ccode>hidden\u003C\u002Fcode> at the \u003Cem>end\u003C\u002Fem> when closing, so it doesn&#39;t clip the fade. It works, and it&#39;s not even an accessibility bug: \u003Ccode>visibility: hidden\u003C\u002Fcode> does pull the element out of the accessibility tree and the tab order while it&#39;s hidden. The real downside is layout — \u003Ccode>visibility: hidden\u003C\u002Fcode> never collapses the box, so the element still occupies its space the whole time, leaving a gap or pushing siblings around until you cover it with something else. The actual fix, for years, meant \u003Ccode>display: none\u003C\u002Fcode> toggled from JavaScript on a \u003Ccode>transitionend\u003C\u002Fcode> listener, timed by hand, one more thing to get wrong.\u003C\u002Fp>",{"id":171,"html":172,"type":138},"b11","\u003Cp>Guess which part people got wrong most. If you said &quot;the timeout that doesn&#39;t match the CSS duration,&quot; you&#39;ve shipped this bug too.\u003C\u002Fp>",{"id":174,"html":175,"text":175,"type":152,"level":31},"b12","What changed",{"id":177,"html":178,"type":138},"b13","\u003Cp>\u003Ccode>transition-behavior: allow-discrete\u003C\u002Fcode> tells the browser: include this property in the transition anyway. Instead of flipping at frame zero, a discrete property now flips at the very end of the transition when going from a value to \u003Ccode>none\u003C\u002Fcode>-equivalent, or at the very start when going the other way — same rule \u003Ccode>visibility\u003C\u002Fcode> already followed, just available to properties that never had it.\u003C\u002Fp>",{"id":180,"code":181,"type":165,"language":78,"highlight":182},"b14",".modal {\n  display: none;\n  opacity: 0;\n  transition: opacity 0.2s, display 0.2s allow-discrete;\n}\n.modal.open {\n  display: block;\n  opacity: 1;\n}",[],{"id":184,"html":185,"type":138},"b15","\u003Cp>Try that alone, though, and you&#39;ll hit the next wall. The modal now fades out correctly — \u003Ccode>display\u003C\u002Fcode> stays \u003Ccode>block\u003C\u002Fcode> for the full duration while opacity eases to \u003Ccode>0\u003C\u002Fcode>, then flips to \u003Ccode>none\u003C\u002Fcode>. But fading \u003Cem>in\u003C\u002Fem> still snaps, because on the very first frame the element goes straight to \u003Ccode>display: block; opacity: 1\u003C\u002Fcode>. There&#39;s no &quot;starting point&quot; to ease from — the element didn&#39;t exist in a transitionable state a moment ago.\u003C\u002Fp>",{"id":187,"html":188,"type":138},"b16","\u003Cp>That&#39;s what \u003Ccode>@starting-style\u003C\u002Fcode> is for.\u003C\u002Fp>",{"id":190,"code":191,"type":165,"language":78,"highlight":192},"b17",".modal {\n  display: none;\n  opacity: 0;\n  transition: opacity 0.2s, display 0.2s allow-discrete;\n\n  @starting-style {\n    opacity: 0;\n  }\n}\n.modal.open {\n  display: block;\n  opacity: 1;\n}",[],{"id":194,"html":195,"type":138},"b18","\u003Cp>\u003Ccode>@starting-style\u003C\u002Fcode> defines the values the browser should treat as &quot;the frame before this element entered the DOM or became displayable.&quot; Without it, there&#39;s nothing before frame zero to transition from — the browser has no prior value, so it has nothing to interpolate. With it, the moment \u003Ccode>display\u003C\u002Fcode> flips to \u003Ccode>block\u003C\u002Fcode>, the element starts at the \u003Ccode>@starting-style\u003C\u002Fcode> values and transitions toward its real ones.\u003C\u002Fp>",{"id":197,"html":198,"type":138},"b19","\u003Cp>Three pieces, each covering a gap the others leave:\u003C\u002Fp>",{"id":200,"type":201,"items":202,"ordered":18},"b20","list",[203,204,205],"\u003Ccode>allow-discrete\u003C\u002Fcode> lets \u003Ccode>display\u003C\u002Fcode> itself sit in the transition queue instead of jumping","\u003Ccode>@starting-style\u003C\u002Fcode> gives the element an entry state to animate \u003Cem>from\u003C\u002Fem>","your normal \u003Ccode>transition\u003C\u002Fcode> and target values do the actual easing, same as always",{"id":207,"html":208,"type":138},"b21","\u003Cp>Drop any one and you&#39;re back to a jump-cut on either the way in, the way out, or both.\u003C\u002Fp>",{"id":210,"html":211,"text":211,"type":152,"level":31},"b22","Try it before you believe it",{"id":213,"html":214,"type":138},"b23","\u003Cp>Toggle the panel below with and without \u003Ccode>allow-discrete\u003C\u002Fcode> wired up. Same markup, same duration — the only difference is whether \u003Ccode>display\u003C\u002Fcode> is allowed into the transition.\u003C\u002Fp>",{"id":216,"html":217,"type":138},"b24","\u003C!-- playground:start -->",{"id":219,"html":220,"text":220,"type":152,"level":31},"b25","🎮 Try it yourself",{"id":222,"html":223,"type":138},"b26","\u003Cp>\u003Cstrong>\u003Ca href=\"https:\u002F\u002Fbestpractic.org\u002Fblog\u002Fcss-transition-behavior-allow-discrete\u002Fplayground\">▶️ Open the interactive playground →\u003C\u002Fa>\u003C\u002Fstrong>\u003C\u002Fp>",{"id":225,"html":226,"type":138},"b27","\u003Cp>\u003Cem>Runs right in your browser — poke at it and watch the concept react live.\u003C\u002Fem>\u003C\u002Fp>",{"id":228,"html":229,"type":138},"b28","\u003C!-- playground:end -->",{"id":231,"html":232,"text":232,"type":152,"level":31},"b29","The part that still trips people up",{"id":234,"html":235,"type":138},"b30","\u003Cp>\u003Ccode>content-visibility: hidden\u003C\u002Fcode> and the native \u003Ccode>&lt;dialog&gt;\u003C\u002Fcode>\u002Fpopover \u003Ccode>overlay\u003C\u002Fcode> property are discrete too, and they&#39;re exactly where this combination earns its keep — you get the rendering-skip benefits of \u003Ccode>content-visibility\u003C\u002Fcode> \u003Cem>and\u003C\u002Fem> an entrance animation, which used to be mutually exclusive. If you&#39;re already using \u003Ccode>content-visibility: auto\u003C\u002Fcode> to skip offscreen rendering, \u003Ccode>allow-discrete\u003C\u002Fcode> is how you animate the same element&#39;s reveal without giving that performance win back.\u003C\u002Fp>",{"id":237,"html":238,"type":138},"b31","\u003Cp>One honest caveat: this is about \u003Ccode>transition\u003C\u002Fcode>, not \u003Ccode>animation\u003C\u002Fcode>. Keyframe animations have had \u003Ccode>@starting-style\u003C\u002Fcode>-adjacent control for longer via \u003Ccode>animation-fill-mode\u003C\u002Fcode>, and discrete properties behave a little differently inside \u003Ccode>@keyframes\u003C\u002Fcode> than inside a plain \u003Ccode>transition\u003C\u002Fcode>. If your modal uses \u003Ccode>animation\u003C\u002Fcode> instead of \u003Ccode>transition\u003C\u002Fcode>, check the specific property&#39;s behavior before assuming \u003Ccode>allow-discrete\u003C\u002Fcode> is even the piece you&#39;re missing.\u003C\u002Fp>",{"id":240,"html":241,"type":138},"b32","\u003Cp>And it&#39;s not magic for every discrete property — \u003Ccode>transition-behavior: allow-discrete\u003C\u002Fcode> only changes \u003Cem>when\u003C\u002Fem> the flip happens relative to the transition&#39;s duration. It still can&#39;t interpolate \u003Ccode>display: block\u003C\u002Fcode> to \u003Ccode>display: flex\u003C\u002Fcode>, because those aren&#39;t &quot;on vs off,&quot; they&#39;re two different values with no path between them. The trick only works for the none ↔ something-else case.\u003C\u002Fp>",{"id":243,"html":244,"type":138},"b33","\u003Cp>Support is more uneven than it looks. Chrome 117 shipped the full combination — including animating \u003Ccode>display\u003C\u002Fcode> itself — soon after \u003Ccode>transition-behavior\u003C\u002Fcode> landed. Safari took two steps: 17.4 added \u003Ccode>transition-behavior\u003C\u002Fcode> and parsed \u003Ccode>allow-discrete\u003C\u002Fcode>, but didn&#39;t extend the discrete-property flip to \u003Ccode>display\u003C\u002Fcode> until Safari 18. Firefox shipped \u003Ccode>transition-behavior\u003C\u002Fcode> and \u003Ccode>@starting-style\u003C\u002Fcode> in 129, but as of late 2026 it still doesn&#39;t reliably transition \u003Ccode>display\u003C\u002Fcode> itself — closing transitions in particular can cancel and jump straight to \u003Ccode>none\u003C\u002Fcode> instead of running the full duration, a long-standing, still-open limitation rather than a recent regression. So build for the gap: the worst case should be the old jump-cut, not broken layout, but on today&#39;s Firefox that jump-cut can still show up on close.\u003C\u002Fp>",{"id":246,"html":247,"text":247,"type":152,"level":31},"b34","Test what you actually know",{"id":249,"html":250,"type":138},"b35","\u003C!-- quiz:start -->",{"id":252,"html":253,"text":253,"type":152,"level":31},"b36","🧠 Test yourself",{"id":255,"html":256,"type":138},"b37","\u003Cp>Think it clicked? \u003Cstrong>\u003Ca href=\"https:\u002F\u002Fbestpractic.org\u002Fblog\u002Fcss-transition-behavior-allow-discrete\u002Fquiz\">Take the 8-question quiz →\u003C\u002Fa>\u003C\u002Fstrong>\u003C\u002Fp>",{"id":258,"html":259,"type":138},"b38","\u003Cp>\u003Cem>Instant feedback, a hint on every question, and an explanation for each answer — right or wrong.\u003C\u002Fem>\u003C\u002Fp>",{"id":261,"html":262,"type":138},"b39","\u003C!-- quiz:end -->",{"id":264,"html":265,"type":138},"b40","\u003Cp>That jump-cut modal isn&#39;t a \u003Ccode>display\u003C\u002Fcode> bug you work around anymore — it&#39;s three CSS features doing exactly what they say: \u003Ccode>allow-discrete\u003C\u002Fcode> admits the property into the transition, \u003Ccode>@starting-style\u003C\u002Fcode> gives it a place to start from, and your existing \u003Ccode>transition\u003C\u002Fcode> line does the rest.\u003C\u002Fp>",{"id":267,"html":268,"type":138},"b41","\u003Cp>Next time you reach for a \u003Ccode>setTimeout\u003C\u002Fcode> to delay a \u003Ccode>display: none\u003C\u002Fcode>, try deleting it instead. What&#39;s the last place in your codebase where JavaScript is still faking something CSS can now do natively? I&#39;d genuinely like to know — drop it in the comments.\u003C\u002Fp>",{"id":270,"html":271,"type":138},"b42","\u003C!-- related:start -->",{"id":273,"html":274,"text":274,"type":152,"level":31},"b43","📚 Read next",{"id":276,"type":201,"items":277,"ordered":18},"b44",[278,279,280],"\u003Ca href=\"https:\u002F\u002Fbestpractic.org\u002Fblog\u002Foverscroll-behavior-scroll-containment\">You&#39;re blocking touchmove events to contain scroll. \u003Ccode>overscroll-behavior\u003C\u002Fcode> does it natively.\u003C\u002Fa>","\u003Ca href=\"https:\u002F\u002Fbestpractic.org\u002Fblog\u002Fcss-grid-lanes-native-masonry-layout\">Stop Using a JS Masonry Library. CSS Grid Lanes Does It Natively.\u003C\u002Fa>","\u003Ca href=\"https:\u002F\u002Fbestpractic.org\u002Fblog\u002Fcss-dynamic-viewport-units-dvh-svh-lvh\">Stop Writing JavaScript To Fix \u003Ccode>100vh\u003C\u002Fcode> On Mobile\u003C\u002Fa>",{"id":282,"html":283,"type":138},"b45","\u003C!-- related:end -->",{"id":285,"type":286},"b46","divider",{"id":288,"html":289,"type":138},"b47","\u003Cp>🚀 \u003Cstrong>Want more like this?\u003C\u002Fstrong> Every guide, playground, and quiz lives on \u003Cstrong>\u003Ca href=\"https:\u002F\u002Fbestpractic.org\u002F\">bestpractic.org\u003C\u002Fa>\u003C\u002Fstrong> — open it and \u003Cstrong>\u003Ca href=\"https:\u002F\u002Fbestpractic.org\u002F\">sign up free\u003C\u002Fa>\u003C\u002Fstrong> so the next one finds you.\u003C\u002Fp>",{"id":291,"html":292,"type":138},"b48","\u003Cp>\u003Cem>Thanks for reading! Let&#39;s stay connected:\u003C\u002Fem>\u003C\u002Fp>",{"id":294,"type":201,"items":295,"ordered":18},"b49",[296,297,298],"⭐ \u003Cstrong>GitHub\u003C\u002Fstrong> — follow me and star the projects: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fparsajiravand\">github.com\u002Fparsajiravand\u003C\u002Fa>","💬 \u003Cstrong>Discord\u003C\u002Fstrong> — join the frontend best-practices community: \u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002Fd9KRhuAwQ\">discord.gg\u002Fd9KRhuAwQ\u003C\u002Fa>","📸 \u003Cstrong>Instagram\u003C\u002Fstrong> — frontend best practices, daily: \u003Ca href=\"https:\u002F\u002Fwww.instagram.com\u002Fbestpractice___\u002F\">@bestpractice___\u003C\u002Fa>","You build a dialog. You add `transition: opacity 0.2s, transform 0.2s`. You open it.\n\nIt just appears. No fade, no slide — a jump-cut, like someone spliced the film.\n\nYou check the transition is spelled right. It is. You check the element is actually changing opacity. It is — from `0` to `1`, exactly like you wrote it. So why does it still snap?\n\nBecause the element isn't only changing opacity. It's also going from `display: none` to `display: block`, and CSS has never known how to transition that.\n\n## The property transitions can't touch\n\n`display` isn't a number, a color, or a length. You can interpolate `opacity: 0` to `opacity: 1` because the browser can compute every value in between — `0.3`, `0.7`, whatever the easing curve wants at that frame. There is no value \"in between\" `none` and `block`. An element is either laid out or it isn't.\n\nProperties like this are **discrete**: `display`, `content-visibility`, `overlay`, `visibility` (sort of — more on that below). The browser's only option has always been to flip them the instant the transition starts, which for `display` means `none → block` happens at frame zero, before your opacity transition even gets going.\n\nSo the classic workaround was: don't touch `display` at all.\n\n```css\n.modal {\n  opacity: 0;\n  visibility: hidden;\n  transition: opacity 0.2s, visibility 0.2s;\n}\n.modal.open {\n  opacity: 1;\n  visibility: visible;\n}\n```\n\n`visibility` gets special-cased by the spec — browsers flip it to `visible` at the *start* of the duration when opening, and to `hidden` at the *end* when closing, so it doesn't clip the fade. It works, and it's not even an accessibility bug: `visibility: hidden` does pull the element out of the accessibility tree and the tab order while it's hidden. The real downside is layout — `visibility: hidden` never collapses the box, so the element still occupies its space the whole time, leaving a gap or pushing siblings around until you cover it with something else. The actual fix, for years, meant `display: none` toggled from JavaScript on a `transitionend` listener, timed by hand, one more thing to get wrong.\n\nGuess which part people got wrong most. If you said \"the timeout that doesn't match the CSS duration,\" you've shipped this bug too.\n\n## What changed\n\n`transition-behavior: allow-discrete` tells the browser: include this property in the transition anyway. Instead of flipping at frame zero, a discrete property now flips at the very end of the transition when going from a value to `none`-equivalent, or at the very start when going the other way — same rule `visibility` already followed, just available to properties that never had it.\n\n```css\n.modal {\n  display: none;\n  opacity: 0;\n  transition: opacity 0.2s, display 0.2s allow-discrete;\n}\n.modal.open {\n  display: block;\n  opacity: 1;\n}\n```\n\nTry that alone, though, and you'll hit the next wall. The modal now fades out correctly — `display` stays `block` for the full duration while opacity eases to `0`, then flips to `none`. But fading *in* still snaps, because on the very first frame the element goes straight to `display: block; opacity: 1`. There's no \"starting point\" to ease from — the element didn't exist in a transitionable state a moment ago.\n\nThat's what `@starting-style` is for.\n\n```css\n.modal {\n  display: none;\n  opacity: 0;\n  transition: opacity 0.2s, display 0.2s allow-discrete;\n\n  @starting-style {\n    opacity: 0;\n  }\n}\n.modal.open {\n  display: block;\n  opacity: 1;\n}\n```\n\n`@starting-style` defines the values the browser should treat as \"the frame before this element entered the DOM or became displayable.\" Without it, there's nothing before frame zero to transition from — the browser has no prior value, so it has nothing to interpolate. With it, the moment `display` flips to `block`, the element starts at the `@starting-style` values and transitions toward its real ones.\n\nThree pieces, each covering a gap the others leave:\n\n- `allow-discrete` lets `display` itself sit in the transition queue instead of jumping\n- `@starting-style` gives the element an entry state to animate *from*\n- your normal `transition` and target values do the actual easing, same as always\n\nDrop any one and you're back to a jump-cut on either the way in, the way out, or both.\n\n## Try it before you believe it\n\nToggle the panel below with and without `allow-discrete` wired up. Same markup, same duration — the only difference is whether `display` is allowed into the transition.\n\n\u003C!-- playground:start -->\n\n## 🎮 Try it yourself\n\n**[▶️ Open the interactive playground →](https:\u002F\u002Fbestpractic.org\u002Fblog\u002Fcss-transition-behavior-allow-discrete\u002Fplayground)**\n\n_Runs right in your browser — poke at it and watch the concept react live._\n\n\u003C!-- playground:end -->\n\n## The part that still trips people up\n\n`content-visibility: hidden` and the native `\u003Cdialog>`\u002Fpopover `overlay` property are discrete too, and they're exactly where this combination earns its keep — you get the rendering-skip benefits of `content-visibility` *and* an entrance animation, which used to be mutually exclusive. If you're already using `content-visibility: auto` to skip offscreen rendering, `allow-discrete` is how you animate the same element's reveal without giving that performance win back.\n\nOne honest caveat: this is about `transition`, not `animation`. Keyframe animations have had `@starting-style`-adjacent control for longer via `animation-fill-mode`, and discrete properties behave a little differently inside `@keyframes` than inside a plain `transition`. If your modal uses `animation` instead of `transition`, check the specific property's behavior before assuming `allow-discrete` is even the piece you're missing.\n\nAnd it's not magic for every discrete property — `transition-behavior: allow-discrete` only changes *when* the flip happens relative to the transition's duration. It still can't interpolate `display: block` to `display: flex`, because those aren't \"on vs off,\" they're two different values with no path between them. The trick only works for the none ↔ something-else case.\n\nSupport is more uneven than it looks. Chrome 117 shipped the full combination — including animating `display` itself — soon after `transition-behavior` landed. Safari took two steps: 17.4 added `transition-behavior` and parsed `allow-discrete`, but didn't extend the discrete-property flip to `display` until Safari 18. Firefox shipped `transition-behavior` and `@starting-style` in 129, but as of late 2026 it still doesn't reliably transition `display` itself — closing transitions in particular can cancel and jump straight to `none` instead of running the full duration, a long-standing, still-open limitation rather than a recent regression. So build for the gap: the worst case should be the old jump-cut, not broken layout, but on today's Firefox that jump-cut can still show up on close.\n\n## Test what you actually know\n\n\u003C!-- quiz:start -->\n\n## 🧠 Test yourself\n\nThink it clicked? **[Take the 8-question quiz →](https:\u002F\u002Fbestpractic.org\u002Fblog\u002Fcss-transition-behavior-allow-discrete\u002Fquiz)**\n\n_Instant feedback, a hint on every question, and an explanation for each answer — right or wrong._\n\n\u003C!-- quiz:end -->\n\nThat jump-cut modal isn't a `display` bug you work around anymore — it's three CSS features doing exactly what they say: `allow-discrete` admits the property into the transition, `@starting-style` gives it a place to start from, and your existing `transition` line does the rest.\n\nNext time you reach for a `setTimeout` to delay a `display: none`, try deleting it instead. What's the last place in your codebase where JavaScript is still faking something CSS can now do natively? I'd genuinely like to know — drop it in the comments.\n\n\u003C!-- related:start -->\n\n## 📚 Read next\n\n- [You're blocking touchmove events to contain scroll. `overscroll-behavior` does it natively.](https:\u002F\u002Fbestpractic.org\u002Fblog\u002Foverscroll-behavior-scroll-containment)\n- [Stop Using a JS Masonry Library. CSS Grid Lanes Does It Natively.](https:\u002F\u002Fbestpractic.org\u002Fblog\u002Fcss-grid-lanes-native-masonry-layout)\n- [Stop Writing JavaScript To Fix `100vh` On Mobile](https:\u002F\u002Fbestpractic.org\u002Fblog\u002Fcss-dynamic-viewport-units-dvh-svh-lvh)\n\n\u003C!-- related:end -->\n\n---\n\n🚀 **Want more like this?** Every guide, playground, and quiz lives on **[bestpractic.org](https:\u002F\u002Fbestpractic.org\u002F)** — open it and **[sign up free](https:\u002F\u002Fbestpractic.org\u002F)** so the next one finds you.\n\n*Thanks for reading! Let's stay connected:*\n\n- ⭐ **GitHub** — follow me and star the projects: [github.com\u002Fparsajiravand](https:\u002F\u002Fgithub.com\u002Fparsajiravand)\n- 💬 **Discord** — join the frontend best-practices community: [discord.gg\u002Fd9KRhuAwQ](https:\u002F\u002Fdiscord.gg\u002Fd9KRhuAwQ)\n- 📸 **Instagram** — frontend best practices, daily: [@bestpractice___](https:\u002F\u002Fwww.instagram.com\u002Fbestpractice___\u002F)",{"title":111,"canonical":301,"description":112},"https:\u002F\u002Fbestpractic.org\u002Fblog\u002Fcss-transition-behavior-allow-discrete","01a1fce0-c3d4-737b-8a48-58490aae3ee0",{"id":304,"locked":18},"01a1fce0-c3f7-7659-a29b-26eab27e9998",[306],{"id":45,"slug":46,"title":48,"_count":307},{"questions":51},[309],{"locale":13,"slug":46},{"id":45,"slug":46,"title":48,"_count":311,"questionCount":51},{"questions":51},[]]