Closed farrago closed 7 years ago
Please especially check that you are happy with my choice in the backwards compatibility section. If you think one of the other choices would be more appropriate then I'm happy to make the change.
I also expect to have PR soon with fixes for the menus: I think that is purely with the demo html having an inline style, and the menu directive itself is ok.
Looks good to me. 👍
Overview
Updates modal directive so that it works with CSP enabled.
Details
Due to the use of inline styles, the modal does not work when CSP is enabled (at least without
unsafe-inline
which is obviously unsafe).This is fixed by:
angular.element.attr({style: ...})
withangular.element.css({...})
. The former is considered unsafe inline styles.modal-window
element is created.display: block
using .css() after the $timeout.Backwards Compatibility
Replacing
backdrop.html
inline style with style applied via JSThe ideal replacement for the inline style would be a class with associated css so it could be over-ridden in end-user templates.
However, angular-foundation-6 doesn't include it's own css and it would be a breaking change to to require apps pull that for a new version.
So the options were:
Option (1) was chosen in the PR because:
This may be a breaking change for a very small number of users, but I find it unlikely and makes it more likely to just work for future users.
Other changes
The other changes should not affect backwards compatibility in any way. Obviously it doesn't fix any inline styles in users' own templates that they may have copied prior to this version.
Test Plan
(Using the CSP testing updates from the previous PR)
gulp
(WITHOUT CSP headers), and check:gulp --csp
(WITH CSP headers), and check:gulp --csp --modules=modal
(WITH CSP headers, modal only), and check: