diff --git a/shepherd.js/src/utils/floating-ui.ts b/shepherd.js/src/utils/floating-ui.ts index bd39425ef..a7312f835 100644 --- a/shepherd.js/src/utils/floating-ui.ts +++ b/shepherd.js/src/utils/floating-ui.ts @@ -202,7 +202,7 @@ export function getFloatingUIOptions( options.placement = attachToOptions.on; } - return deepmerge(step.options.floatingUIOptions || {}, options); + return deepmerge(options, step.options.floatingUIOptions || {}); } function addArrow(step: Step) { diff --git a/test/unit/utils/general.spec.js b/test/unit/utils/general.spec.js index 879ff35e6..bc0d6c79f 100644 --- a/test/unit/utils/general.spec.js +++ b/test/unit/utils/general.spec.js @@ -76,7 +76,7 @@ describe('General Utils', function () { }); describe('floatingUIOptions', function () { - it('middleware can be overridden', function () { + it('middleware options are passed in last', function () { const step = new Step( {}, { @@ -98,7 +98,8 @@ describe('General Utils', function () { step.options.attachTo, step ); - expect(floatingUIOptions.middleware[0].options.altAxis).toBe(false); + // Shepherd pushes in flip and shift by default, so this is 3rd + expect(floatingUIOptions.middleware[2].options.altAxis).toBe(false); }); it('positioning strategy is explicitly set', function () {