{"record":{"id":"425a3ad98dddbbd6","repo":"Dogfalo/materialize","slug":"nouislider-fixed-behaviour-must-be-used-with-2","errorCode":null,"errorMessage":"noUiSlider: 'fixed' behaviour must be used with 2 handles","messagePattern":"noUiSlider: 'fixed' behaviour must be used with 2 handles","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extras/noUiSlider/nouislider.js","lineNumber":684,"sourceCode":"    function testBehaviour ( parsed, entry ) {\n\n        // Make sure the input is a string.\n        if ( typeof entry !== 'string' ) {\n            throw new Error(\"noUiSlider: 'behaviour' must be a string containing options.\");\n        }\n\n        // Check if the string contains any keywords.\n        // None are required.\n        var tap = entry.indexOf('tap') >= 0;\n        var drag = entry.indexOf('drag') >= 0;\n        var fixed = entry.indexOf('fixed') >= 0;\n        var snap = entry.indexOf('snap') >= 0;\n        var hover = entry.indexOf('hover') >= 0;\n\n        if ( fixed ) {\n\n            if ( parsed.handles !== 2 ) {\n                throw new Error(\"noUiSlider: 'fixed' behaviour must be used with 2 handles\");\n            }\n\n            // Use margin to enforce fixed state\n            testMargin(parsed, parsed.start[1] - parsed.start[0]);\n        }\n\n        parsed.events = {\n            tap: tap || snap,\n            drag: drag,\n            fixed: fixed,\n            snap: snap,\n            hover: hover\n        };\n    }\n\n    function testTooltips ( parsed, entry ) {\n\n        if ( entry === false ) {","sourceCodeStart":666,"sourceCodeEnd":702,"githubUrl":"https://github.com/Dogfalo/materialize/blob/824e78248b3de81e383445e76ffb04cc3264fe7d/extras/noUiSlider/nouislider.js#L666-L702","documentation":"The 'fixed' behaviour makes two handles move in lockstep and is enforced via testMargin(start[1]-start[0]). Because it needs a pair of handles to lock together, noUiSlider rejects it when the slider does not have exactly 2 handles.","triggerScenarios":"Call noUiSlider.create() with options.behaviour containing the substring 'fixed' AND options.start with a length other than 2 (which sets parsed.handles). For example start:[0] with behaviour 'drag-fixed', or start:[0,25,50] with behaviour 'fixed'.","commonSituations":"Adding 'fixed' to behaviour while keeping a single-handle or multi-handle config; changing the number of start values without updating behaviour; or copying a config snippet between sliders with different handle counts.","solutions":["Provide exactly two start values, e.g. start: [20, 80], when using 'fixed'.","Remove 'fixed' from behaviour if you need 1 or 3+ handles (use 'drag' or 'tap' instead).","Verify parsed.handles equals start.length before adding 'fixed' to the behaviour string."],"exampleFix":"// before\nnoUiSlider.create(el, { start: [0], range:{min:0,max:100}, behaviour: 'drag-fixed' });\n// after\nnoUiSlider.create(el, { start: [20, 80], range:{min:0,max:100}, behaviour: 'drag-fixed' });","handlingStrategy":"validation","validationCode":"function assertFixedMatchesHandles(opts) {\n  const handles = Array.isArray(opts.start) ? opts.start.length : 1;\n  if (typeof opts.behaviour === 'string' && opts.behaviour.includes('fixed') && handles !== 2) {\n    throw new Error(\"'fixed' behaviour requires exactly 2 start values\");\n  }\n}","typeGuard":"function canUseFixed(opts) {\n  const handles = Array.isArray(opts.start) ? opts.start.length : 1;\n  return handles === 2;\n}","tryCatchPattern":null,"preventionTips":["When changing start.length, re-evaluate whether 'fixed' still applies.","Keep handle count and behaviour together in one config block.","Add a CI test that asserts handle/behaviour combinations."],"tags":["nouislider","validation","configuration","handles"],"backgroundTag":null,"analyzedSha":"824e78248b3de81e383445e76ffb04cc3264fe7d","analyzedAt":"2026-08-13T04:14:22.506Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}