CSS Variable with HSL not recalculating - nested

Situation
I have the following definitions (simplified) in my CSS file.
:root {
--app-color-hue: 30;
--app-color: hsl(var(--app-color-hue), 80%, 60%);
}
body {
--app-color-hue: 145;
background: var(--app-color);
}
I was expecting to use the CSS variable app-color throughout my application and set the hue through --app-color-hue. However, the body element shows up Orange (30) instead of Green (145).
When I set the hsl myself in the value, the color updates just fine.
body {
background: hsl(var(--app-color-hue), 80%, 60%);
}
Codepen: https://codepen.io/Dyljyn/pen/BaNVwqE
Possible explanation
I'm assuming the problem is that hsl does detect the change and does not recalculate when a CSS variable inside it is updated in another element.
Question
Does anyone have more insight on this matter?
I also don't know how I can report this as a bug if it is considered a bug. So I'd also appreciate anyone pointing me in the right direction regarding this.

I found the answer myself.
Custom properties are scoped to the element(s) they are declared on,
and participate in the cascade: the value of such a custom property is
that from the declaration decided by the cascading algorithm.
Source: https://developer.mozilla.org/en-US/docs/Web/CSS/--*
So my "possible explanation" is by design and therefor not a bug.

Related

React Virtualized List - How do you use the measureAllRows method on a List?

I'm trying to render my list of data using the WindowScroller and List from react-virtualized, but for some reason, only a portion of my data is rendering. I've read over the docs and I believe I have all the necessary props...help is appreciated!
Taking my List out of the WindowScroller renders everything correctly, but I'd like to keep the WindowScroller to give scrolling controls to the parent element.
There are 100 items in my data set, but only a portion of them are rendering.
Here is a sandbox with an example: https://codesandbox.io/s/jolly-gagarin-vczki1?file=/src/App.js
UPDATE #1:
I believe I've found the cause of my error! It seems that the height in the List element is the issue; it's not large enough thus cutting off my data. Because my List has no fixed height to begin with (height depends entirely on the number of children), I think I need a way to dynamically calculate the height of the List. I did find a method for List elements called measureAllRows, but I can't get it to work :( (see my sandbox above)
UPDATE #2:
I found a really hacky way to do it; by setting the List element's height prop to Infinity, I can get all of my items to render. This doesn't feel like a good way to solve the problem, but it does fix my issue with a dynamic list height.
UPDATE #3:
The answer below helped when just using AutoSizer, but I was curious... if I were to put my AutoSizer into a WindowScroller like so: https://codesandbox.io/s/ecstatic-sunset-g4k3ly?file=/src/App.js, how could I achieve a similar fix for displaying all of my data?
I can say that the problem lies in one of the parent div for WindowScroller component which is causing this behaviour.
The overflow property cannot be set to auto for WindowScroller to work. If you try executing only the windowScroller part without modal window it works as expected.
https://codesandbox.io/s/elastic-ritchie-k938m0?file=/src/App.js
I was also stuck with similar problem and this worked for me, in your code try removing the autoheight parameter and get the height from the autosizer.
Reference:
https://codesandbox.io/s/recursing-pine-2w2m8f?file=/src/App.js

Vertical scrollbar visibility in react-virtualized table

When using react-virtualized's Table class with a table with many columns, it is necessary to scroll horizontally to the very end of the columns in order to be able to see the vertical scrollbar.
(you can see an extremely similar question about React-Table here, it is not clear to me if react-virtualized's table code uses React-Table's code at all, but in any case I am having an identical problem)
in the linked issue someone commented that:
.ReactTable .rt-tbody{
overflow: initial !important;
}
fixed their issue. I checked this solution with react-table and got the desired behavior.
However, as far as I can tell react-virtualized table doesn't have tbody class available for css. (The docs do list a bunch of available class names, but a body class name doesn't seem to be on that list).
I've messed around with the css trying to set different overflow options in different ways to no avail. I have not been able to get the vertical scrollbar to display without needing to horizontally scroll all the way to the end. What can I do to make that happen?
(Edit: I've also tried to figure out some way to make this work with react-floating-scroll but it seems like the ref passed back by virtualized table isn't the kind of ref the scroll code needs...)
This will move the scroll bar to the left side instead of right side.
.ReactVirtualized__Table {
.ReactVirtualized__Table__Grid {
direction: rtl !important;
.ReactVirtualized__Grid__innerScrollContainer {
direction: ltr !important;
}
}
}

Datalabels on Highmaps appearing bottom to top

I am facing a strange problem with Highmaps. I have a geojson map that Highmaps shows properly. Mouseover works and tooltips appear in the correct places. However, when I turn on data labels, they appear upside down. That is, a label that should appear near the bottom of the map (centered on its province) now appears near the top, and vice-versa. The data labels' coordinate system seems to be reversed.
In the image, the label "603863" should appear over the bottom-most province, while "1966085" should appear over the topmost province.
A sample of my geojson data:
var provincePolygons = {
"type":"FeatureCollection",
"features":[
{"type":"Feature",
"properties":{
"id":"05","name":"Tete"},
"geometry":{"type":"Polygon",
"coordinates":[[
[32.636,-14.204],
[33.245,-13.998],
[33.299,-14.032],
[33.300,-14.146],
[33.385,-14.237],
[33.478,-14.404],
[33.544,-14.434],
[33.627,-14.528],
[33.640,-14.594],
[33.718,-14.572],
...
Things I have tried:
The data labels are SVG elements. I thought that maybe surrounding CSS rules might be affecting their position, but since the other CSS elements, using similar transformations, are in the correct locations, that doesn't seem to be the problem.
The longitudes are negative values. I experimented with making them positive by adding +100 to each value, just to see if the negative values were to blame, but they were not. It was a long shot.
I've played, naturally, with the API settings for data labels, but there does not seem to be a switch that affects their top-to-bottom placement. I would also think that leaving the default values untouched should result in correct placement.
I have wondered how data labels' location is calculated by Highmaps. Perhaps Highmaps cannot find the center of each polygon and needs a hint? I added latitude and longitude values to the feature in the geojson, but that did not help. I've also used Highmaps before in a similar situation without needing to add such data.
There is a group called "highcharts-data-labels" in the generated SVG. I am considering trying the flip its coordinate system upside-down somehow to move the data labels to their correct position, but that would a complex intervention for something that should work correctly.
Please note that I am using ng-highcharts.
What am I doing wrong?
For anyone else running into this problem, I was able to solve this by adding the property 'chartType' to my config object. The docs for the highcharts-ng library mention this for making a highstock chart, but don't say anything about it for highmaps. The lib defaults to 'chart', but you need to put chartType: 'map', and it should fix the problem :)
Here's the relevant code from the highcharts-ng libary, where config is your chart Object:
var chartTypeMap = {
'stock': 'StockChart',
'map': 'Map',
'chart': 'Chart'
};
function getChartType(config) {
if (config === undefined || config.chartType === undefined) return 'Chart';
return chartTypeMap[('' + config.chartType).toLowerCase()];
}
Hope this helps!

strokeWidth not working for path-group

I am trying to add strokeWidth for imported path-group type objects in fabricjs, but it is not working though if i view in console the updated strokeWdith exist. Here is my code
canvas.getObjects()[x].strokeWidth += 11.34;
canvas.renderAll();
Any help please?
as far I understand, it is not possible to add strokeWidth to complex (path-group) type object, as there are so many different shapes that develops that complex object. Adding strokeWidth will make the shape/object broken pieces.

What does <color indexed="81"> mean?

I have a document created by Excel 2007:
<fileVersion appName="xl" lastEdited="4" lowestEdited="4" rupBuild="4506" codeName="{B7FE6334-C1A2-E50D-BD3D-5F4D41BBC2E3}"/>
... which contains the following color in a font definition in xl/styles.xml:
<color indexed="81"/>
I understand from the ECMA standard that this colour index refers to the <indexedColors> collection in xl/styles.xml if there is such a collection, otherwise it refers to the default palette shown in the standard. My problem is that this document contains no <indexedColors> element, and the default palette only has 66 entries, so I do not know what 81 refers to. Does anybody else?
Interestingly a google search for color indexed="81" returns some sample OpenXML snippets containing the same thing, but alas no explanation.
MSDN Documentation specifies the indexed property of class Color in OpenXML as:
Indexed color value. Only used for backwards compatibility. References a color in indexedColors.
The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.
It is part of the larger DocumentFormat.OpenXml.Spreadsheet namespace.
The file you're describing was built via source code which contained the 81 value. It probably looked something like this Java code, defining a Color() instance with 81U from an unrelated color index.
If you're needing to find out why, I'd create an account at MSDN and reply to Jack9999's post with an inquiry as to why he used that value. I'm guessing it's a bug on his part, being familiar with a separate and possibly JAVA-related color index.
Excel--not recognizing it--is just using their default comment color values.
Cheers
Index 0x51 is the system tooltip text color. (i.e. ::GetSysColor(COLOR_INFOTEXT) ).
NECRO answer:
From Vincent Tan's SpreadsheetOpenXmlFromScratch:
For colours, if you're dealing with the DocumentFormat.OpenXml.Color class,
there are 3 ways of setting the colour value:
Indexed colour
RGB colour
Themed colour
There's a property called Auto of the Color class. I didn't find a use for it, and you can probably ignore it. Excel won't choke on errors if you don't set it in any caseā€¦
Indexed colours are for backwards compatibility, so I'm not going to teach you how. Basically it's an index value to the palette of colours stored within the spreadsheet's stylesheet. We'll deal with the Stylesheet class in the next chapter. You can explore the IndexedColors class on your own, which is a child class of the Colors class, which is in turn a child class of Stylesheet.

Resources