Skip to content

Commit

Permalink
fix(toast): resolve an issue that the height was not measured correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
cschroeter committed Apr 18, 2024
1 parent 2ac0f00 commit ccb1fa5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/real-bobcats-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zag-js/toast": patch
---

Fix an issue that the height was not exactly measured
4 changes: 2 additions & 2 deletions packages/machines/toast/src/toast.machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export function createToastMachine<T>(options: Options<T>) {
const syncHeight = () => {
const originalHeight = rootEl.style.height
rootEl.style.height = "auto"
const newHeight = rootEl.offsetHeight
const newHeight = rootEl.getBoundingClientRect().height
rootEl.style.height = originalHeight

ctx.height = newHeight
Expand Down Expand Up @@ -173,7 +173,7 @@ export function createToastMachine<T>(options: Options<T>) {
const originalHeight = rootEl.style.height
rootEl.style.height = "auto"

const newHeight = rootEl.offsetHeight
const newHeight = rootEl.getBoundingClientRect().height
rootEl.style.height = originalHeight
ctx.height = newHeight

Expand Down

0 comments on commit ccb1fa5

Please sign in to comment.