{"record":{"id":"103ab8d30fab6e9a","repo":"Dogfalo/materialize","slug":"nouislider-direction-option-was-not-recognized","errorCode":null,"errorMessage":"noUiSlider: 'direction' option was not recognized.","messagePattern":"noUiSlider: 'direction' option was not recognized\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extras/noUiSlider/nouislider.js","lineNumber":662,"sourceCode":"        if ( parsed.padding >= 50 ) {\n            throw new Error(\"noUiSlider: 'padding' option must be less than half the range.\");\n        }\n    }\n\n    function testDirection ( parsed, entry ) {\n\n        // Set direction as a numerical value for easy parsing.\n        // Invert connection for RTL sliders, so that the proper\n        // handles get the connect/background classes.\n        switch ( entry ) {\n            case 'ltr':\n                parsed.dir = 0;\n                break;\n            case 'rtl':\n                parsed.dir = 1;\n                break;\n            default:\n                throw new Error(\"noUiSlider: 'direction' option was not recognized.\");\n        }\n    }\n\n    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","sourceCodeStart":644,"sourceCodeEnd":680,"githubUrl":"https://github.com/Dogfalo/materialize/blob/824e78248b3de81e383445e76ffb04cc3264fe7d/extras/noUiSlider/nouislider.js#L644-L680","documentation":"noUiSlider only accepts two values for the 'direction' option. The testDirection switch handles 'ltr' (dir=0) and 'rtl' (dir=1) and throws on anything else, including typos, casing differences, or non-string values.","triggerScenarios":"Call noUiSlider.create() with options.direction set to anything other than exactly the strings 'ltr' or 'rtl' (e.g. 'LTR', 'horizontal', 'right', 'rtl ' with trailing space, or a non-string like true).","commonSituations":"Case mismatch ('LTR'), localized config sources that translate the value, copy-paste from CSS direction properties ('rtl' vs 'row-rtl'), trailing whitespace from template literals or JSON with spaces, or passing a boolean/number instead of a string.","solutions":["Set direction to exactly 'ltr' or 'rtl' (lowercase, no whitespace).","Trim and lowercase the value if it comes from user input or config: direction: String(raw).trim().toLowerCase().","Omit the option entirely to accept the default ('ltr')."],"exampleFix":"// before\nnoUiSlider.create(el, { start: 0, range: {min:0,max:100}, direction: 'RTL' });\n// after\nnoUiSlider.create(el, { start: 0, range: {min:0,max:100}, direction: 'rtl' });","handlingStrategy":"validation","validationCode":"const ALLOWED = new Set(['ltr', 'rtl']);\nfunction normalizeDirection(raw) {\n  const v = String(raw).trim().toLowerCase();\n  if (!ALLOWED.has(v)) throw new TypeError(`direction must be 'ltr' or 'rtl', got ${raw}`);\n  return v;\n}","typeGuard":"function isValidDirection(v) {\n  return v === 'ltr' || v === 'rtl';\n}","tryCatchPattern":null,"preventionTips":["Normalize external direction strings with trim().toLowerCase() before passing.","Define direction as a string-union type in TypeScript: 'ltr' | 'rtl'.","Avoid inferring direction from CSS properties; set it explicitly."],"tags":["nouislider","validation","configuration","string-literal"],"backgroundTag":null,"analyzedSha":"824e78248b3de81e383445e76ffb04cc3264fe7d","analyzedAt":"2026-08-13T04:14:22.506Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}