FlowFuse / FlowFuse/node-red-dashboard
Unable to use `</> class` in ui-notification widget
- Dominant language
- HTML
- Stars
- 355
- Forks
- 82
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 24
Description
I'm trying to change the appearance of a notification node using CSS style defined in a template node, which works fine.
```
.nrdb-ui-notification .v-snackbar__wrapper {
background-color: red;
border-left: 0px
}
```
Result -

However... I need to specify the class in the notification node to ensure that the styling **only** applies to that node, and I don't seem to be able to do so.
It has been [discussed in the forum](https://discourse.nodered.org/t/apply-styles-to-individual-ui-nodes-dashboard-2/96884), and other members have suggested;
> _Inspecting the notification in the developer tools, I can see no sign of the the class. I suggest filing an issue_
Without being able to confine the css to that node, it affects other notifications, such as the PWA pop-ups -

Example flow;
```
[{"id":"ffdc76785f8ce058","type":"group","z":"377bddeb0095cfd4","name":"Button with confirmation","style":{"fill":"#e3f3d3","label":true},"nodes":["0946e16e5b47813b","1bdf3dbd393321d9","8a1e5c20a1fa0c97","6133763840c32655","ef3b0c92fe4e636f","2b40907b13fff3f5"],"x":74,"y":114,"w":812,"h":122},{"id":"0946e16e5b47813b","type":"ui-button","z":"377bddeb0095cfd4","g":"ffdc76785f8ce058","group":"b1f57c00ab19b181","name":"","label":"button","order":1,"width":"1","height":"1","emulateClick":false,"tooltip":"","color":"","bgcolor":"","className":"","icon":"","iconPosition":"left","payload":"
Confirm Action
Press 'confirm' to complete the action
","payloadType":"str","topic":"","topicType":"str","buttonColor":"","textColor":"","iconColor":"","enableClick":true,"enablePointerdown":false,"pointerdownPayload":"","pointerdownPayloadType":"str","enablePointerup":false,"pointerupPayload":"","pointerupPayloadType":"str","x":150,"y":155,"wires":[["1bdf3dbd393321d9"]]},{"id":"1bdf3dbd393321d9","type":"ui-notification","z":"377bddeb0095cfd4","g":"ffdc76785f8ce058","ui":"8c151b59721a8d9a","position":"center center","colorDefault":true,"color":"#000000","displayTime":"100","showCountdown":true,"outputs":1,"allowDismiss":true,"dismissText":"Close","allowConfirm":true,"confirmText":"Confirm","raw":true,"className":"confirm-action","name":"","x":325,"y":155,"wires":[["8a1e5c20a1fa0c97"]]},{"id":"8a1e5c20a1fa0c97","type":"switch","z":"377bddeb0095cfd4","g":"ffdc76785f8ce058","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"confirm_clicked","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":495,"y":155,"wires":[["6133763840c32655"],[]]},{"id":"6133763840c32655","type":"change","z":"377bddeb0095cfd4","g":"ffdc76785f8ce058","name":"change","rules":[{"t":"set","p":"payload","pt":"msg","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":155,"wires":[["ef3b0c92fe4e636f"]]},{"id":"ef3b0c92fe4e636f","type":"debug","z":"377bddeb0095cfd4","g":"ffdc76785f8ce058","name":"debug 6","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":780,"y":155,"wires":[]},{"id":"2b40907b13fff3f5","type":"ui-template","z":"377bddeb0095cfd4","g":"ffdc76785f8ce058","group":"","page":"5f0bda35e5ab69ba","ui":"","name":"","order":0,"width":0,"height":0,"head":"","format":".nrdb-ui-notification .v-snackbar__wrapper {\nbackground-color: red;\nborder-left: 0px\n}\n","storeOutMessages":true,"passthru":true,"resendOnRefresh":true,"templateScope":"page:style","className":"","x":305,"y":195,"wires":[[]]},{"id":"b1f57c00ab19b181","type":"ui-group","name":"snippets","page":"5f0bda35e5ab69ba","width":"13","height":"6","order":1,"showTitle":true,"className":"","visible":"true","disabled":"false","groupType":"default"},{"id":"8c151b59721a8d9a","type":"ui-base","name":"Homeserver","path":"/dashboard","appIcon":"https://homeserver.forest-bicolor.ts.net/icon","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showReconnectNotification":true,"notificationDisplayTime":"1","showDisconnectNotification":true,"allowInstall":true},{"id":"5f0bda35e5ab69ba","type":"ui-page","name":"Examples","ui":"8c151b59721a8d9a","path":"/examples","icon":"home","layout":"grid","theme":"6a4b46dde830beb1","breakpoints":[{"name":"Default","px":"0","cols":"3"},{"name":"Tablet","px":"576","cols":"6"},{"name":"Small Desktop","px":"768","cols":"9"},{"name":"Desktop","px":"1024","cols":"12"}],"order":3,"className":"","visible":"true","disabled":"false"},{"id":"6a4b46dde830beb1","type":"ui-theme","name":"Default Theme","colors":{"surface":"#ffffff","primary":"#0094ce","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"density":"compact","pagePadding":"12px","groupGap":"6px","groupBorderRadius":"4px","widgetGap":"12px"}}]```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the ui-notification widget and inspect the rendered notification in browser developer tools, focusing on why the configured className does not appear. Verify that the class is applied only to that notification and that the CSS no longer affects PWA pop-ups.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, html
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100