Page 1 of 1

CSS: Obtaining access to a contextual menu with no value selected

Posted: Mon May 10, 2021 3:55 pm
by Xander
Hello,

I am new to using CSS in oXygenXML Author, and more specifically the form controls.
I have managed to customize quite a bit of the CSS to fit my needs.

Recently, I tried to add a pop-up, to facilitate my work process in choosing the value for a specific attribute.

Code: Select all

*[class ~= "task/step"][importance="value1"]:before,
*[class ~= "task/step"][importance="value2"]:before {
    content: oxy_popup(
    ...
    ); 
}
With this, as long as a value has been selected for the attribute, the contextual menu can be used.
However, if "no value" is selected or is already present, when the element is selected (which is the case), I cannot retrieve the contextual menu.

Is there a method to enable the contextual menu to be called even when there is no value?

Re: CSS: Obtaining access to a contextual menu with no value selected

Posted: Tue May 11, 2021 4:22 pm
by alex_jitianu
Hello,

This popup form control is editing the attribute @importance? If that's the case, change the selector to match any step element, even one without a @importance set:

Code: Select all

*[class ~= "task/step"]:before {
    content: oxy_popup(
    ...
    ); 
}
Best regards,
Alex

Re: CSS: Obtaining access to a contextual menu with no value selected

Posted: Fri May 14, 2021 11:14 am
by Xander
Hi Alex,

Thank you for the quick reply.

I actually want the pop up form control to edit the attribute @importance.

The issue I am having is when the value has the possibility of having no value.

If value1 or value2 have been preselected, then I can select another value from the pop up, if I decide to change the attribute value, however, when 'No Value' is selected, the pop up control will disappear, and the only way to select the attributes from that point is to head over to the Attributes view or edit the attribute in the text mode.

Code: Select all

*[class ~= "task/step"][importance="value1"]:before,
*[class ~= "task/step"][importance="value2"]:before {
    content: oxy_popup(
    	edit, '@importance',
         	values, "value1, value2,  ",
         	labels, "Value1: , Value2: , 'No Value' ",
         	... ;
    ); 
}

Re: CSS: Obtaining access to a contextual menu with no value selected

Posted: Tue May 18, 2021 8:59 am
by alex_jitianu
Hi,

As I see it, the culprit is the CSS selector:

Code: Select all

*[class ~= "task/step"][importance="value1"]:before,
*[class ~= "task/step"][importance="value2"]:before 
These selectors match the step element only if the @importance attribute has either value1 or value2. It means that when the @importance attribute is missing this selector doesn't match anymore and the form control is not added. That's why I suggested a more relaxed selector that matches the step element no matter the value of @importance:

Code: Select all

*[class ~= "task/step"]:before {
Did you try replacing your selectors with this one?

Best regards,
Alex

Re: CSS: Obtaining access to a contextual menu with no value selected

Posted: Tue May 18, 2021 2:28 pm
by Xander
Hi Alex,

I apologize, it seems as though I misunderstood your first reply.

Yes, this works perfectly.

I was just bit confused when I had tried it because when I removed @importance attribute, I ended up seeing something like Value1: Value1, printed inside a step element in the author mode, however, I realized that has to do with another CSS rule, which was previously created by someone else.

Thank you for your quick and informative replies.