@@ -313,6 +313,19 @@ async function getFont(id: string): Promise<Font | null> {
313313 return font ;
314314}
315315
316+ function reenableMutedSliders ( font : Font , container : Element ) {
317+ ( container as HTMLElement ) . addEventListener (
318+ "mousedown" ,
319+ async ( ) => {
320+ if ( ! font . inherit ) return ;
321+ container . classList . remove ( "mute" ) ;
322+ font . inherit = false ;
323+ await updateFont ( font ) ;
324+ } ,
325+ { once : true }
326+ ) ;
327+ }
328+
316329async function applyNamedInstance ( e : Event ) {
317330 const sel = e . target as HTMLSelectElement ;
318331 const parent = sel . closest ( ".font" ) as HTMLFieldSetElement ;
@@ -326,13 +339,9 @@ async function applyNamedInstance(e: Event) {
326339
327340 font . inherit = sel . value == "--inherit--" ;
328341
329- sliders . querySelectorAll ( ".variable-slider" ) . forEach ( slider => {
330- let input = slider . querySelector ( "input" ) ;
331- input . disabled = font . inherit ;
332- } ) ;
333-
334342 if ( font . inherit ) {
335343 sliders . classList . add ( "mute" ) ;
344+ reenableMutedSliders ( font , sliders ) ;
336345 await updateFont ( font ) ;
337346 return ;
338347 }
@@ -367,6 +376,9 @@ async function addVariableSliders(font: Font, el: HTMLElement) {
367376 // If we start with inherit, we start muted
368377 if ( font . inherit ) {
369378 container . classList . add ( "mute" ) ;
379+ // If a user clicks muted sliders, assume they want to
380+ // go into custom axes mode
381+ reenableMutedSliders ( font , container ) ;
370382 }
371383}
372384
@@ -380,8 +392,6 @@ function addSlider(font: Font, axis: Axis, parent: HTMLElement) {
380392 const label : HTMLLabelElement = el . querySelector ( "label" ) ;
381393 const value : HTMLSpanElement = el . querySelector ( ".slider-value" ) ;
382394
383- input . disabled = font . inherit ;
384-
385395 label . innerText = axis . name ;
386396
387397 input . name = `var-${ axis . id } ` ;
0 commit comments