NativeScript / NativeScript/NativeScript

CSS shorthand properties like margin gets overriden by margin-bottom

Open
#8,141 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css enhancement
Dominant language
TypeScript
Stars
25.7k
Forks
1.7k
Avg merge
1d 5h
Merged PRs (30d)
35

Description

Environment

  • CLI: 6.1.2
  • Android Runtime: 6.1.2
  • Nativescript with Angular
  • @nativescript/theme

Describe the bug
It seems like CSS properties like margin-bottom: 50px; override their shorthand counterpart margin: 0;. I've only tried on Android with Angular.

To Reproduce

  1. Create a Nativescript with angular project.
  2. Include the @nativescript/theme.
  3. Create two buttons on a page.
  4. Add the h2 class from the theme and a custom hello class on the first button.
.hello {
  margin: 0; /* doesn't remove the bottom margin from the button that has the h2 class. */
  /* margin-bottom: 0; */ /* does remove the bottom margin if uncommented. */
}
  1. See that the first button has a bottom margin that is only removed if we uncomment the margin-bottom: 0;.

Expected behavior
Shorthand properties like margin should not differ from using margin-bottom like it works on the web.

Sample project
https://play.nativescript.org/?template=play-ng&id=nGvrVO
Uncomment the margin-bottom in home.component.css to see that it will remove margin which should already be removed by the margin: 0 just above it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked NativeScript Angular sample and home.component.css, then reproduce the issue on Android with @nativescript/theme using the stated margin rules. Done means margin: 0 removes the themed bottom margin just as margin-bottom: 0 does.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.