Metadata
- Source
- FLUID-6615
- Type
- Bug
- Priority
- Major
- Status
- Open
- Resolution
- N/A
- Assignee
- Antranig Basman
- Reporter
- Antranig Basman
- Created
2021-04-22T10:07:55.905-0400 - Updated
2024-07-17T08:09:10.440-0400 - Versions
- N/A
- Fixed Versions
- N/A
- Component
-
- Framework
Description
The defaults in "fluid.covidMap.visiblePanel" at https://github.com/inclusive-design/covid-data-monitor/blob/main/src/js/covidMap.js#L1165 have to use a clunky workaround of applying an initial default value of "null" since otherwise their initial value of "false" ends up getting relayed back into the parent regardless of an excludeSource directive.
The problematic code currently looks like
fluid.defaults("fluid.covidMap.visiblePanel", {
gradeNames: "fluid.viewComponent",
styles: {
hiddenOnMobile: "fl-mapviz-hidden-on-mobile"
},
model: {
// Use the initial value "null" to prevent the component applies the value false at the page load
visible: null
},
modelRelay: {
expandPanel: {
source: "visible",
target: "{expandButton}.model.expanded",
backward: "never"
}
},
modelListeners: {
toggleCssClass: {
path: "visible",
func: "fluid.covidMap.visiblePanel.toggleClass",
args: ["{that}"]
}
}
});
fluid.covidMap.visiblePanel.toggleClass = function (that) {
// Use "null" as the initial visibility value in order not to programmatically apply any visibility control
// at the initial page load. The initial page template has all visibility css applied properly for the mobile
// view. This is to work around the issue that using `excludeSource: "init"` doesn't help in this case.
if (that.model.visible === null) {
return;
}
that.container.toggleClass(that.options.styles.hiddenOnMobile, !that.model.visible);
};
This looks like it is a further elaboration of init relay priority problems like those in FLUID-6517, FLUID-6429