Skip to content

Mask size incorrect when target element has a different box-sizing #1273

@lorenzos

Description

@lorenzos

I'm using Mask (Spinner, really) on an Element that has box-sizing: border-box. In this case the line Mask.js:119 obviously returns an incorrect target element size because padding and border are considered when they should not. So, the mask results bigger than it should.

The issue for me is not that the default behaviour resizes the mask incorrectly, but it's the fact this behaviour cannot be changed. So, for me, the solution can be one of the following:

  1. The ['padding', 'border'] array defined in Mask.js:115 and then used in getComputedSize() can be a class option instead of hardcoded there. That way also the maskMargins option can be included in this new option, but I guess is better to leave also as it is for retro-compatibility.
  2. The same ['padding', 'border'] can be built depending on the value of this.target.getStyle('box-sizing') instead of hardcoded, but I'm not sure if this works on all browsers: box-sizing is still somewhere not supported, partially supported or need prefixes (source).

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/2942371-mask-size-incorrect-when-target-element-has-a-different-box-sizing?utm_campaign=plugin&utm_content=tracker%2F22069&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F22069&utm_medium=issues&utm_source=github).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions