Skip to content

Commit fb732ba

Browse files
authored
fix(compute): custom behavior lack block and inline defaults (#227)
fix(compute): custom behavior missing block and inline defaults
1 parent 4a00163 commit fb732ba

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/compute.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,12 @@ export default (
186186
target: Element,
187187
options: Options = {}
188188
): CustomScrollAction[] => {
189-
const { scrollMode, block, inline, boundary } = {
190-
scrollMode: 'always',
191-
block: 'center',
192-
inline: 'nearest',
193-
...options,
194-
}
189+
const {
190+
scrollMode = 'always',
191+
block = 'center',
192+
inline = 'nearest',
193+
boundary,
194+
} = options
195195
// Allow using a callback to check the boundary
196196
// The default behavior is to check if the current target matches the boundary element or not
197197
// If undefined it'll check that target is never undefined (can happen as we recurse up the tree)

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ const getOptions = (options: any = true): StandardBehaviorOptions => {
5959
} else if (options === false) {
6060
return { block: 'end', inline: 'nearest' }
6161
} else if (isOptionsObject<StandardBehaviorOptions>(options)) {
62-
return { block: 'center', inline: 'nearest', ...options }
62+
// compute.ts ensures the defaults are block: 'center' and inline: 'nearest', to conform to the spec
63+
return options
6364
}
6465

6566
// if options = {}, based on w3c web platform test

0 commit comments

Comments
 (0)